dlib: DLL load failed for CUDA on Python 3.8 for Windows
Expected Behavior
>>> import dlib
>>> :)
Current Behavior
>>> import dlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing dlib: The specified module could not be found.
>>> :(
Steps to Reproduce
- Install CUDA
- Install cuDNN
git clone https://github.com/davisking/dlib.gitpython setup.py installpython -c"import dlib"
Because of A change in Python 3.8 for Windows, Python no longer searches for DLLs in directories listed in the PATH environment variable and fails to find curand64_10.dll, this is fixed after running os.add_dll_directory(os.path.join(os.environ['CUDA_PATH'], 'bin'))
- Version: 19.19.99
- Where did you get dlib: this github repo
- Platform: Python 3.8 64-bit for Windows 10
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 2
- Comments: 27 (9 by maintainers)
@Mouradost I just pushed a change to github that should make this work without needing to assume anything about
CUDA_PATH. So try the latest dlib on github.Let me see if I can do that in the next few days, I have everything needed to reproduce it anyway.
I am facing the same error but on Python 3.9, I compiled it and everything seemed okay. But when i import dlib the before mentioned DLL error is displayed.
EDIT: I got Cuda to run in WSL 2, so I’ll probably stick with it even if windows gets fixed. I’d suggest dropping windows all together once WSL 2 is outside of the Windows insider program
EDIT: after installing the expirmental CUDA for WSL driver it also worked on windows, but don’t ask me why
I had a situation that dlib crashed when I did import it, in general I did the following. I changed setup.py and set it to compile Debug, but with Release it didn’t work on Win 7 x 4 Py 3.7.
link on setup_for Debug compile https://drive.google.com/file/d/1Wfy9ou3yYce4wqywY22jPxC9IkN6_Dch
Where was it? Oh you noted in your other comment. Really we should make the install process record the location of the copy it found rather than expecting the user to do something special.
I don’t see cudnn’s .dll file in that list. You need to install cudnn. Which is curious, since cmake must have found a copy of cudnn somewhere on your computer based on other things you said.
On Sun, Jun 14, 2020 at 4:08 AM mourad lablack notifications@github.com wrote:
@Mouradost That doesn’t look like the contents of the CUDA_PATH variable, but PATH or something else. I say this because it would be very surprising if all those c:\windows paths were in CUDA_PATH.
I just pushed a change to how dlib is packaged that should fix this. So pull the latest dlib from github and try installing that version.
I followed the same steps but I’m still getting the error of DLL load failed while importing dlib: The specified module could not be found
Urg, windows dynamic loading is such a mess 😦