diff --git a/Libs/Application/Job/PythonWorker.cpp b/Libs/Application/Job/PythonWorker.cpp index e2169cb862..00a46e50fa 100644 --- a/Libs/Application/Job/PythonWorker.cpp +++ b/Libs/Application/Job/PythonWorker.cpp @@ -16,6 +16,10 @@ using namespace pybind11::literals; // to bring in the `_a` literal #include #include +#ifdef _WIN32 +#include +#endif + namespace shapeworks { //--------------------------------------------------------------------------- @@ -207,6 +211,21 @@ bool PythonWorker::init() { qputenv("PATH", path.toUtf8()); SW_LOG("Setting PATH for Python to: " + path.toStdString()); + + // Python 3.8+ requires explicit DLL directory registration + // PATH environment variable is no longer used for DLL search + SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_USER_DIRS); + + // Add the Library\bin directory where conda keeps DLLs like libexpat.dll + QString library_bin = python_home + "/Library/bin"; + AddDllDirectory(library_bin.toStdWString().c_str()); + + // Also add the DLLs directory + QString dlls_dir = python_home + "/DLLs"; + AddDllDirectory(dlls_dir.toStdWString().c_str()); + + // And the base python home + AddDllDirectory(python_home.toStdWString().c_str()); } #endif // ifdef _WIN32 diff --git a/Support/package_windows.sh b/Support/package_windows.sh index 592b136490..5645b15ebe 100755 --- a/Support/package_windows.sh +++ b/Support/package_windows.sh @@ -36,7 +36,10 @@ ROOT=`pwd` BUILD="/c/build" CONDA_LOC="/c/Miniconda/envs/shapeworks" -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 + +ls -la ${CONDA_LOC}/Library/bin + +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 # install visual studio redistributables WIN_DIR="/c/Windows/system32" diff --git a/install_shapeworks.bat b/install_shapeworks.bat index 3bfc921859..b8efaf2593 100644 --- a/install_shapeworks.bat +++ b/install_shapeworks.bat @@ -11,7 +11,7 @@ call conda config --add channels anaconda call conda config --add channels conda-forge REM install shapeworks deps -call conda create --yes --name %CONDAENV% python=3.9.13 pip=22.1.2 openssl==1.1.1w || goto :error +call conda create --yes --name %CONDAENV% python=3.12 pip=24.3.1 openssl==0.3.30 || goto :error call conda activate %CONDAENV% REM reactivate shapeworks environment @@ -21,10 +21,10 @@ call conda activate %CONDAENV% call python -m pip install -r python_requirements.txt || goto :error REM install ptorch using light-the-torch -call ltt install torch==1.11.0 || goto :error +call ltt install torch==2.2.2 || goto :error REM different versions of open3d for different OSes, so we install it manually here -call pip install open3d==0.17.0 || goto :error +call pip install open3d==0.19.0 || goto :error call pip install Python/DatasetUtilsPackage.tar.gz || goto :error call pip install Python/DocumentationUtilsPackage.tar.gz || goto :error