RTK icon indicating copy to clipboard operation
RTK copied to clipboard

Windows Python packages failed to load with static compilation and RTK_USE_CUDA

Open SimonRit opened this issue 3 years ago • 3 comments

Error message is

File “D:\lib\pyITK_build\Wrapping\Generators\Python\itk\support…\RTKPython.py”, line 13, in
from . import _RTKPython
ImportError: DLL load failed while importing _RTKPython: cannot find specified module.

See https://discourse.itk.org/t/building-itk-with-python-wrappers/4396/6. This issue should be fixed before #434 in my opinion. @LucasGandel @Thibault-Pelletier @GabrieleBelotti

SimonRit avatar Oct 14 '21 14:10 SimonRit

The bug is still present using ITK and RTK master branches. Looks like _RTKPython fails to load the CUDA Toolkit libraries.

@GabrieleBelotti FYI it can be worked around by providing the CUDAToolkit libraries at runtime: os.add_dll_directory("C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/bin") I'll investigate why the CUDA libs are not found and will update.

I'll also look into builds using shared libs which fail because of redefinition issues.

I also reproduce #434 but let's fix this first.

LucasGandel avatar Nov 24 '21 13:11 LucasGandel

The bug is still present using ITK and RTK master branches. Looks like _RTKPython fails to load the CUDA Toolkit libraries.

@GabrieleBelotti FYI it can be worked around by providing the CUDAToolkit libraries at runtime: os.add_dll_directory("C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/bin") I'll investigate why the CUDA libs are not found and will update.

I'll also look into builds using shared libs which fail because of redefinition issues.

I also reproduce #434 but let's fix this first.

Thanks Lucas, I managed to reproduce again the error and using your workaround I managed to run some reconstruction codes in python.

GabrieleBelotti avatar Nov 25 '21 13:11 GabrieleBelotti

@LucasGandel By chance I compiled the library on a similar win10 machine that was running python 3.7 instead of 3.8. The issue is not reproduced and I don't need a workaround. Can't tell if this is due to the python version or to the different folder organization for this other machine.

GabrieleBelotti avatar Dec 10 '21 16:12 GabrieleBelotti