Skip to content

Commit b213366

Browse files
authored
Merge pull request #2471 from SCIInstitute/amorris/windows-python-3.12
Changes for windows python 3.12
2 parents 8e2ade1 + 711ec7e commit b213366

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

Libs/Application/Job/PythonWorker.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ using namespace pybind11::literals; // to bring in the `_a` literal
1616
#include <QThread>
1717
#include <iostream>
1818

19+
#ifdef _WIN32
20+
#include <windows.h>
21+
#endif
22+
1923
namespace shapeworks {
2024

2125
//---------------------------------------------------------------------------
@@ -207,6 +211,21 @@ bool PythonWorker::init() {
207211

208212
qputenv("PATH", path.toUtf8());
209213
SW_LOG("Setting PATH for Python to: " + path.toStdString());
214+
215+
// Python 3.8+ requires explicit DLL directory registration
216+
// PATH environment variable is no longer used for DLL search
217+
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_USER_DIRS);
218+
219+
// Add the Library\bin directory where conda keeps DLLs like libexpat.dll
220+
QString library_bin = python_home + "/Library/bin";
221+
AddDllDirectory(library_bin.toStdWString().c_str());
222+
223+
// Also add the DLLs directory
224+
QString dlls_dir = python_home + "/DLLs";
225+
AddDllDirectory(dlls_dir.toStdWString().c_str());
226+
227+
// And the base python home
228+
AddDllDirectory(python_home.toStdWString().c_str());
210229
}
211230
#endif // ifdef _WIN32
212231

Support/package_windows.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ ROOT=`pwd`
3636

3737
BUILD="/c/build"
3838
CONDA_LOC="/c/Miniconda/envs/shapeworks"
39-
cp ${CONDA_LOC}/python*.dll ${CONDA_LOC}/Library/bin/zlib.dll ${CONDA_LOC}/Library/bin/tbb12.dll ${CONDA_LOC}/Library/bin/zstd.dll ${CONDA_LOC}/Library/bin/libpng16.dll ${CONDA_LOC}/Library/bin/half.dll ${CONDA_LOC}/Library/bin/boost_filesystem.dll ${CONDA_LOC}/Library/bin/spdlog.dll ${CONDA_LOC}/Library/bin/*ffi*.dll ${CONDA_LOC}/Library/bin/libbz2.dll $BUILD/bin/Release
39+
40+
ls -la ${CONDA_LOC}/Library/bin
41+
42+
cp ${CONDA_LOC}/python*.dll ${CONDA_LOC}/Library/bin/zlib.dll ${CONDA_LOC}/Library/bin/tbb12.dll ${CONDA_LOC}/Library/bin/zstd.dll ${CONDA_LOC}/Library/bin/libpng16.dll ${CONDA_LOC}/Library/bin/half.dll ${CONDA_LOC}/Library/bin/boost_filesystem.dll ${CONDA_LOC}/Library/bin/spdlog.dll ${CONDA_LOC}/Library/bin/*ffi*.dll ${CONDA_LOC}/Library/bin/libbz2.dll ${CONDA_LOC}/Library/bin/libssl-3-x64.dll ${CONDA_LOC}/Library/bin/libcrypto-3-x64.dll ${CONDA_LOC}/Library/bin/pcre2-16.dll $BUILD/bin/Release
4043

4144
# install visual studio redistributables
4245
WIN_DIR="/c/Windows/system32"

install_shapeworks.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ call conda config --add channels anaconda
1111
call conda config --add channels conda-forge
1212

1313
REM install shapeworks deps
14-
call conda create --yes --name %CONDAENV% python=3.9.13 pip=22.1.2 openssl==1.1.1w || goto :error
14+
call conda create --yes --name %CONDAENV% python=3.12 pip=24.3.1 openssl==0.3.30 || goto :error
1515
call conda activate %CONDAENV%
1616

1717
REM reactivate shapeworks environment
@@ -21,10 +21,10 @@ call conda activate %CONDAENV%
2121
call python -m pip install -r python_requirements.txt || goto :error
2222

2323
REM install ptorch using light-the-torch
24-
call ltt install torch==1.11.0 || goto :error
24+
call ltt install torch==2.2.2 || goto :error
2525

2626
REM different versions of open3d for different OSes, so we install it manually here
27-
call pip install open3d==0.17.0 || goto :error
27+
call pip install open3d==0.19.0 || goto :error
2828

2929
call pip install Python/DatasetUtilsPackage.tar.gz || goto :error
3030
call pip install Python/DocumentationUtilsPackage.tar.gz || goto :error

0 commit comments

Comments
 (0)