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

  1. Install CUDA
  2. Install cuDNN
  3. git clone https://github.com/davisking/dlib.git
  4. python setup.py install
  5. python -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)

Most upvoted comments

@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

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

1. Install CUDA

2. Install cuDNN

3. `git clone https://github.com/davisking/dlib.git`

4. `python setup.py install`

5. `python -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

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:

So whats in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin? These are the files in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin [image: image] https://user-images.githubusercontent.com/17816194/84588343-2be56e00-ae59-11ea-9146-d744a4594f25.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/davisking/dlib/issues/2039#issuecomment-643733806, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPYFRZH72KFTJVMOR5QMLTRWSAQXANCNFSM4LVOATAQ .

@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.

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

  1. Install CUDA
  2. Install cuDNN
  3. git clone https://github.com/davisking/dlib.git
  4. python setup.py install
  5. python -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

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 😦