Home python Python: Module installed but ImportError: DLL load failed: The specified module could...

Python: Module installed but ImportError: DLL load failed: The specified module could not be found

Author

Date

Category

I’m trying to install the DLIB http://dlib.net/ .

Via the command:

pip install dlib

installs and works fine, but as I understand it does not use CUDA technology. I spent more than one day on this compilation and installation, so I will show the installation sequence, what if someone encounters the same:

OS: Windows 7 x64
Python: 2.7.15 x64
Visual Studio 15.8.4 2017
NVidia CUDA 9.2
cudnn-9.2-windows7-x64-v7.2.1.38

When I installed with all these dependencies, it was written in the log that my VS version was not suitable, then before that I read somewhere that this happens and can be edited to get around this limitation.

So went here

C: \ Program Files \ NVIDIA GPU Computing
Toolkit \ CUDA \ v9.2 \ include \ crt \ host_config.h

And on 131 lines, I don’t remember what was there, something like if the version is not lower and not higher, then I did not lower and everything, or rather replaced it with this line:

# if _MSC_VER & lt; 1600

Now I will describe the sequence of actions:

git clone https://github.com/davisking/dlib.git
cd dlib
mkdir build
cd build
cmake .. -DDLIB_USE_CUDA = 1 -DUSE_AVX_INSTRUCTIONS = 1 -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH = "D: /cudnn-9.2-windows7-x64-v7.2.1.38/cuda/"
cmake --build.

Here everything assembled perfectly without errors, and the log showed that CUDA Enabling, as opposed to installing it according to the official documentation.

Next, install in Python:

cd ..
python setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA --set CMAKE_PREFIX_PATH = "D: /cudnn-9.2-windows7-x64-v7.2.1.38/cuda/" --clean

After compilation, which was not fast and heavily loading the system, it was clear that CUDA Enabling was also shown in green at the end. Successfully installed and the library was copied to the directory:

C: \ Python27 \ Lib \ site-packages \ dlib-19.15.99-py2.7-win-amd64 .egg \

After not much joy that I finally installed it, this is what came out:

  • I have already transferred the dlib.pyd file C: \ Python27 \ Lib \ site-packages \
  • Demolished and installed all versions of the Visual C++ Redistributable Package for
    Visual Studio, because this was written somewhere with a similar problem, but for
    another library.

Nothing helped.


Answer 1, authority 100%

Python writes that the library was not found, but this was not related to dlib, but to the requirement of some library written in the dlib module itself (which I initially confused the module with the library). And then it dawned on me to add the path to:

to the PATH environment variables.

D: \ cudnn-9.2-windows7-x64-v7.2.1.38 \ cuda \ bin

This is where the required library is located: cudnn64_7.dll

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions