Python: The module is installed, but ImportError: DLL load failed: The specified module was not found
Trying to install the DLIB library http://dlib.net/.
Via the command:
Pip install dlib
It is perfectly installed and works, 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, suddenly someone will encounter the same thing:
ОС: 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 it with all these dependencies, it was written in the log that the version of my VS is not suitable, then before that, I read somewhere that this happens and can be edited to circumvent this restriction.
So I went here
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include\crt\host_config.h
And on 131 lines, I do not remember what was there, something like if the version is not lower and not higher, then I did not lower and everything, but rather replaced it with this line:
#if _MSC_VER < 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 .
Everything is fine here it was assembled without errors, and in the log it was clear that CUDA Enabling, unlike if it was installed according to the official documentation.
Next, I install it 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 a not fast and very system-loading compilation, it was seen that the same CUDA Enabling and green at the end was 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, it came out here what:
- 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 it was written somewhere with a similar problem, but for a different library.
Nothing helped.
1 answers
Python writes that the library was not found, but this did not apply to dlib, but to the requirement of some library registered in the dlib module itself (that I initially confused the module with the library). And then it dawned on me to add the path to:{[2] 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