Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: DLL load failed: The specified module could not be found. #1954

Closed
thwestz opened this issue Dec 23, 2019 · 14 comments
Closed

ImportError: DLL load failed: The specified module could not be found. #1954

thwestz opened this issue Dec 23, 2019 · 14 comments

Comments

@thwestz
Copy link

thwestz commented Dec 23, 2019

Expected Behavior

Use dlib with cuda on window 10 64bit

Current Behavior

running install
running bdist_egg
running egg_info
creating dlib.egg-info
writing dlib.egg-info\PKG-INFO
writing dependency_links to dlib.egg-info\dependency_links.txt
writing top-level names to dlib.egg-info\top_level.txt
writing manifest file 'dlib.egg-info\SOURCES.txt'
package init file 'dlib_init_.py' not found (or not a regular file)
reading manifest file 'dlib.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'dlib.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Building extension for Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake D:\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:\Program Files\Python36\python.exe -G Visual Studio 15 2017 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=D:\dlib\build\lib.win-amd64-3.6 -A x64'
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.16.27034.0
-- The CXX compiler identification is MSVC 19.16.27034.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Program Files/Python36/python.exe (found version "3.6.6")
-- Found PythonLibs: C:/Program Files/Python36/libs/Python36.lib
-- pybind11 v2.2.2
-- Using CMake version: 3.14.4
-- Compiling dlib version: 19.15.0
-- SSE4 instructions can be executed by the host processor.
-- AVX instructions can be executed by the host processor.
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Enabling AVX instructions
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0 (found suitable version "10.0", minimum required is "7.5")
-- Looking for cuDNN install...
-- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/lib/x64/cudnn.lib
-- Building a CUDA test project to see if your compiler is compatible with CUDA...
-- Checking if you have the right version of cuDNN installed.
-- Enabling CUDA support for dlib. DLIB WILL USE CUDA
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/dlib/build/temp.win-amd64-3.6/Release
Invoking CMake build: 'cmake --build . --config Release -- /m'
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Checking Build System
CMake does not need to re-run because D:/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/generate.stamp is up-to-date.
CMake does not need to re-run because D:/dlib/build/temp.win-amd64-3.6/Release/pybind11_build/CMakeFiles/generate.stamp is up-to-date.
CMake does not need to re-run because D:/dlib/build/temp.win-amd64-3.6/Release/dlib_build/CMakeFiles/generate.stamp is up-to-date.
Building NVCC (Device) object dlib_build/CMakeFiles/dlib.dir/cuda/Release/dlib_generated_cuda_dlib.cu.obj
cuda_dlib.cu
cuda_dlib.cu
Building NVCC (Device) object dlib_build/CMakeFiles/dlib.dir/cuda/Release/dlib_generated_cusolver_dlibapi.cu.obj
cusolver_dlibapi.cu
cusolver_dlibapi.cu
Building Custom Rule D:/dlib/dlib/CMakeLists.txt
CMake is re-running because D:/dlib/build/temp.win-amd64-3.6/Release/dlib_build/CMakeFiles/generate.stamp is out-of-date.
the file 'D:/dlib/build/temp.win-amd64-3.6/Release/dlib_build/CMakeFiles/dlib.dir/cuda/dlib_generated_cuda_dlib.cu.obj.depend'
is newer than 'D:/dlib/build/temp.win-amd64-3.6/Release/dlib_build/CMakeFiles/generate.stamp.depend'
result='-1'
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- pybind11 v2.2.2
-- Using CMake version: 3.14.4
-- Compiling dlib version: 19.15.0
-- SSE4 instructions can be executed by the host processor.
-- AVX instructions can be executed by the host processor.
-- Enabling AVX instructions
-- Looking for cuDNN install...
-- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/lib/x64/cudnn.lib
-- Enabling CUDA support for dlib. DLIB WILL USE CUDA
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/dlib/build/temp.win-amd64-3.6/Release
base64_kernel_1.cpp
bigint_kernel_1.cpp
bigint_kernel_2.cpp
bit_stream_kernel_1.cpp
entropy_decoder_kernel_1.cpp
entropy_decoder_kernel_2.cpp
entropy_encoder_kernel_1.cpp
entropy_encoder_kernel_2.cpp
md5_kernel_1.cpp
tokenizer_kernel_1.cpp
unicode.cpp
image_dataset_metadata.cpp
mnist.cpp
global_function_search.cpp
kalman_filter.cpp
test_for_odr_violations.cpp
auto.cpp
sockets_kernel_1.cpp
bsp.cpp
dir_nav_kernel_1.cpp
dir_nav_kernel_2.cpp
dir_nav_extensions.cpp
linker_kernel_1.cpp
extra_logger_headers.cpp
logger_kernel_1.cpp
logger_config_file.cpp
misc_api_kernel_1.cpp
misc_api_kernel_2.cpp
sockets_extensions.cpp
sockets_kernel_2.cpp
sockstreambuf.cpp
sockstreambuf_unbuffered.cpp
server_kernel.cpp
server_iostream.cpp
server_http.cpp
multithreaded_object_extension.cpp
threaded_object_extension.cpp
threads_kernel_1.cpp
threads_kernel_2.cpp
threads_kernel_shared.cpp
thread_pool_extension.cpp
async.cpp
timer.cpp
stack_trace.cpp
cpu_dlib.cpp
tensor_tools.cpp
fonts.cpp
widgets.cpp
drawable.cpp
canvas_drawing.cpp
style.cpp
base_widgets.cpp
gui_core_kernel_1.cpp
gui_core_kernel_2.cpp
png_loader.cpp
save_png.cpp
jcomapi.cpp
jdapimin.cpp
jdapistd.cpp
jdatasrc.cpp
jdcoefct.cpp
jdcolor.cpp
jddctmgr.cpp
jdhuff.cpp
jdinput.cpp
jdmainct.cpp
jdmarker.cpp
jdmaster.cpp
jdmerge.cpp
jdphuff.cpp
jdpostct.cpp
jdsample.cpp
jerror.cpp
jidctflt.cpp
jidctfst.cpp
jidctint.cpp
jidctred.cpp
jmemmgr.cpp
jmemnobs.cpp
jquant1.cpp
jquant2.cpp
jutils.cpp
jcapimin.cpp
jdatadst.cpp
jcparam.cpp
jcapistd.cpp
jcmarker.cpp
jcinit.cpp
jcmaster.cpp
jcdctmgr.cpp
jccoefct.cpp
jccolor.cpp
jchuff.cpp
jcmainct.cpp
jcphuff.cpp
jcprepct.cpp
jcsample.cpp
jfdctint.cpp
jfdctflt.cpp
jfdctfst.cpp
jpeg_loader.cpp
save_jpeg.cpp
cudnn_dlibapi.cpp
cublas_dlibapi.cpp
curand_dlibapi.cpp
cuda_data_ptr.cpp
gpu_data.cpp
png.c
pngerror.c
pngget.c
pngmem.c
pngpread.c
pngread.c
pngrio.c
pngrtran.c
pngrutil.c
pngset.c
pngtrans.c
pngwio.c
pngwrite.c
pngwtran.c
pngwutil.c
adler32.c
compress.c
crc32.c
deflate.c
gzclose.c
gzlib.c
gzread.c
gzwrite.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
dlib.vcxproj -> D:\dlib\build\temp.win-amd64-3.6\Release\dlib_build\Release\dlib19.15.0_release_64bit_msvc1916.lib
Building Custom Rule D:/dlib/tools/python/CMakeLists.txt
CMake does not need to re-run because D:/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/generate.stamp is up-to-date.
dlib.cpp
matrix.cpp
vector.cpp
svm_c_trainer.cpp
D:\dlib\tools\python\src\vector.cpp(62): warning C4101: 'e': unreferenced local variable [D:\dlib\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj]
svm_rank_trainer.cpp
decision_functions.cpp
other.cpp
basic.cpp
D:\dlib\tools\python\src\basic.cpp(22): warning C4101: 'e': unreferenced local variable [D:\dlib\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj]
cca.cpp
sequence_segmenter.cpp
svm_struct.cpp
D:\dlib\tools\python\src\svm_struct.cpp(59): warning C4101: 'e': unreferenced local variable [D:\dlib\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj]
D:\dlib\tools\python\src\svm_struct.cpp(51): note: while compiling class template member function 'void svm_struct_prob<psi_type>::separation_oracle(const long,const dlib::matrix<double,0,1,dlib::default_memory_manager,dlib::row_major
_layout> &,double &,std::vector<ulong_double_pair,std::allocator<_Ty>> &) const'
with
[
psi_type=std::vector<ulong_double_pair,std::allocator<ulong_double_pair>>,
_Ty=ulong_double_pair
]
D:\dlib\tools\python\src\svm_struct.cpp(110): note: see reference to class template instantiation 'svm_struct_prob<psi_type>' being compiled
with
[
psi_type=std::vector<ulong_double_pair,std::allocator<ulong_double_pair>>
]
D:\dlib\tools\python\src\svm_struct.cpp(136): note: see reference to function template instantiation 'dlib::matrix<double,0,1,dlib::default_memory_manager,dlib::row_major_layout> solve_structural_svm_problem_impl<std::vector<ulong_dou
ble_pair,std::allocator<_Ty>>>(pybind11::object)' being compiled
with
[
_Ty=ulong_double_pair
]
image.cpp
image2.cpp
image3.cpp
image4.cpp
D:\dlib\dlib..\dlib/image_transforms/assign_image.h(86): warning C4018: '>=': signed/unsigned mismatch (compiling source file D:\dlib\tools\python\src\image3.cpp) [D:\dlib\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj]
D:\dlib\dlib..\dlib/image_transforms/assign_image.h(160): note: see reference to function template instantiation 'void dlib::impl_assign_image_scaled<out_image_type,src_image_type>(dlib::image_view<out_image_type> &,const src_image_t
ype &,const double)' being compiled
with
[
out_image_type=dlib::numpy_image<int8_t>,
src_image_type=dlib::matrix_op<dlib::op_image_to_mat<dlib::numpy_image<uint32_t>,uint32_t>>
] (compiling source file D:\dlib\tools\python\src\image3.cpp)
D:\dlib\dlib..\dlib/image_transforms/assign_image.h(177): note: see reference to function template instantiation 'void dlib::impl_assign_image_scaled<dest_image_type,dlib::matrix_op<dlib::op_image_to_mat<src_image_type,T>>>(dest_imag
e_type &,const dlib::matrix_op<dlib::op_image_to_mat<src_image_type,T>> &,const double)' being compiled
with
[
dest_image_type=dlib::numpy_image<int8_t>,
src_image_type=dlib::numpy_image<uint32_t>,
T=uint32_t
] (compiling source file D:\dlib\tools\python\src\image3.cpp)
D:\dlib\tools\python\src\image3.cpp(27): note: see reference to function template instantiation 'void dlib::assign_image_scaled<dlib::numpy_image<int8_t>,dlib::numpy_image<uint32_t>>(dest_image_type &,const src_image_type &,const doub
le)' being compiled
with
[
dest_image_type=dlib::numpy_image<int8_t>,
src_image_type=dlib::numpy_image<uint32_t>
]
D:\dlib\tools\python\src\image3.cpp(435): note: see reference to function template instantiation 'pybind11::array convert_image_scaled<uint32_t>(const dlib::numpy_image<uint32_t> &,const std::string &,const double)' being compiled
D:\dlib\dlib..\dlib/image_transforms/assign_image.h(87): warning C4018: '<=': signed/unsigned mismatch (compiling source file D:\dlib\tools\python\src\image3.cpp) [D:\dlib\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj]
rectangles.cpp
object_detection.cpp
shape_predictor.cpp
correlation_tracker.cpp
face_recognition.cpp
cnn_face_detector.cpp
global_optimization.cpp
image_dataset_metadata.cpp
numpy_returns.cpp
line.cpp
gui.cpp
Creating library D:/dlib/build/temp.win-amd64-3.6/Release/Release/dlib.lib and object D:/dlib/build/temp.win-amd64-3.6/Release/Release/dlib.exp
dlib_python.vcxproj -> D:\dlib\build\lib.win-amd64-3.6\dlib.cp36-win_amd64.pyd
Building Custom Rule D:/dlib/tools/python/CMakeLists.txt
CMake does not need to re-run because D:/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/generate.stamp is up-to-date.
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
copying build\lib.win-amd64-3.6\dlib.cp36-win_amd64.pyd -> build\bdist.win-amd64\egg
creating stub loader for dlib.cp36-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\dlib.py to dlib.cpython-36.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying dlib.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying dlib.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying dlib.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying dlib.egg-info\not-zip-safe -> build\bdist.win-amd64\egg\EGG-INFO
copying dlib.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt
creating dist
creating 'dist\dlib-19.15.0-py3.6-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing dlib-19.15.0-py3.6-win-amd64.egg
creating c:\program files\python36\lib\site-packages\dlib-19.15.0-py3.6-win-amd64.egg
Extracting dlib-19.15.0-py3.6-win-amd64.egg to c:\program files\python36\lib\site-packages
Adding dlib 19.15.0 to easy-install.pth file

Installed c:\program files\python36\lib\site-packages\dlib-19.15.0-py3.6-win-amd64.egg
Processing dependencies for dlib==19.15.0
Finished processing dependencies for dlib==19.15.0

Steps to Reproduce

  1. download dlib from github
  2. go to dlib folder and run python setup.py install -G "Visual Studio 15 2017" --clean
  3. import dlib
  4. get error

import dlib
Traceback (most recent call last):
File "", line 1, in
ImportError: DLL load failed: The specified module could not be found.

@davisking
Copy link
Owner

davisking commented Dec 23, 2019 via email

@thwestz
Copy link
Author

thwestz commented Dec 24, 2019

Same error.If possible, In my environment have 2 visual studio ( 2017 , 2019 ) ?

@davisking
Copy link
Owner

Try building with cuda. Give --clean --no DLIB_USE_CUDA

@davisking
Copy link
Owner

And run pip uninstall dlib a bunch to make sure you don't have several versions of dlib installed first.

@thwestz
Copy link
Author

thwestz commented Dec 27, 2019

Now,i typing

  1. pip uninstall dlib
  2. python setup.py install -G "Visual Studio 15 2017" --clean --no DLIB_USE_CUDA
    i can import dlib but my dlib.DLIB_USE_CUDA return false
    this mean my dlib not use gpu ? and how to turn it to true ?

@davisking
Copy link
Owner

davisking commented Dec 28, 2019 via email

@thwestz
Copy link
Author

thwestz commented Jan 2, 2020

Thank you,
Now i can solved this problem via set CUDA runtime in my PATH

@thwestz thwestz closed this as completed Jan 2, 2020
@yanglixiao1994
Copy link

@thwestz Could you explain more specific?I have the same problem.How to set CUDA runtime PATH?My PATH already have the path to CUDA when i install it.Just like the picture below:
image
image
Thanks for any advise.

@Itach1Uchixa
Copy link

Itach1Uchixa commented Mar 18, 2020

Getting same error with CUDA v10.2 in Windows 10. Can you explain step-by-step how to add CUDA runtime to PATH? I have added all paths that shown here but error persisted after compilation.
I am using: Visual Studio 2019 compiler, CMake 3.17.0-rc3, CUDA 10.2, CUDnn 7.6, python 3.5.
For information I can compile and run CUDA sample projects with Visual Studio 2019
Please help! Thanks in advance.

@cashlo
Copy link

cashlo commented Mar 28, 2020

@yanglixiao1994 @Itach1Uchixa Are you using Python 3.8? I have the same error, and after digging into this until 5am, it turns out Python 3.8 no longer load DLLs from PATH, the same issue and a fix is documented here in a different project. I have created another issue #2039

@Itach1Uchixa
Copy link

Itach1Uchixa commented Mar 28, 2020

@cashlo I actually got it compiled by adding CUDNN\bin dir to my PATH. Somehow you need to add CUDNN\bin dir too not just CUDNN root dir. In my case (and I think in many cases too) cmake couldn't find dll file inside CUDNN\bin dir and compiled dlib with CPU support only. Below is my working path configuration
my_working_path_conf

@ahsanfayaz52
Copy link

I had the same issue i was using python 3.6 and dlib 19.19.0 so i just downgraded my dlib version to 19.8.1 and booommm it workd for me

@ahsanfayaz52
Copy link

I also uninstalled cuda 10.1 and installed cuda 8.0 as cuda 10.1 was giving me runtime error i suggest to downgrad your cuda version too

@siddh2
Copy link

siddh2 commented Jul 27, 2020

WhatsApp Image 2020-07-27 at 10 52 25 AM

when i try to import dlib then I get error
My error



ImportError: DLL load while importing dlib: A dynamic link library (DLL) initialization routing failed.

plz help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants