DLL load failed with opencv 3.1 and python 3.5

asked 2016-02-22 02:41:27 -0600

adamsss gravatar image

updated 2016-02-22 07:49:51 -0600

berak gravatar image

Hello,

I installed library OpenCV 3.1 successfully - i used whl file, but i can't import cv2 anyway in my script. I saw this topic: link text ,but installing Microsoft Visual C++ 2015 Redistributable still didn't solve my problem:

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

When i used pip list module opencv-python is successful installed.

Any suggestions?

PS. I tried different versions of whl files, but it still doesn't help.

CMake output:

Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "2.7" (found C:/Python27/ArcGIS10.2/python.exe)
Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "2.6" (found )
Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Caffe:   NO
Protobuf:   NO
Glog:   NO
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Tesseract:   NO
Could NOT find PROTOBUF (missing:  PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) 
Build libprotobuf from sources:
    libprotobuf not found into system
    The protocol buffer compiler not found
Tesseract:   NO

General configuration for OpenCV 3.1.0 =====================================
  Version control:               unknown

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       2.8.11.2
    CMake generator:             Visual Studio 10
    CMake build tool:            C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe
    MSVC:                        1600

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe  (ver 16.0.40219.1)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast  /wd4251 /wd4324 /wd4275 /wd4589 /MP4  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast  /wd4251 /wd4324 /wd4275 /wd4589 /MP4  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast    /MP4  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast    /MP4  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:X86   /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:X86   /debug /INCREMENTAL 
    Precompiled headers:         YES
    Extra dependencies:
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 core flann imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python3
    Disabled:                    world contrib_world
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 viz ...
(more)
edit retag flag offensive close merge delete

Comments

  • the prebuilt cv2.pyd that comes with opencv's binary dist from sourceforge is for python2.7

  • any other whl files on the net are unofficial, not maintained by opencv.

  • if you need python3 support, you have to build it from src locally, usig cmake.

berak gravatar imageberak ( 2016-02-22 02:45:56 -0600 )edit

I built it from src... like this: link text

but it still doens't import cv2 (the same error) !

adamsss gravatar imageadamsss ( 2016-02-22 05:33:28 -0600 )edit

========== Build: 3 succeeded, 1 failed, 53 up-to-date, 0 skipped ========== and python 3.5 folder is still empty :(

adamsss gravatar imageadamsss ( 2016-02-22 05:57:04 -0600 )edit

i know, it's long, but try to add the complete cmake output to your question ?

berak gravatar imageberak ( 2016-02-22 05:59:39 -0600 )edit

Link to raport from cmake: link text

adamsss gravatar imageadamsss ( 2016-02-22 06:07:12 -0600 )edit

did you try to build it in DEBUG mode ? there is no pythonXX.lib for that, so the build will fail.

if so, try to build the INSTALL project in release mode. if successful, it will copy your cv2.pyd to the desired location

berak gravatar imageberak ( 2016-02-22 07:55:11 -0600 )edit

also, you probably want a static build, so cv2.pyd no more depends on external opencv dll's, so make sure, you got the BUILD_SHARED_LIBS flag set to OFF in cmake

berak gravatar imageberak ( 2016-02-22 08:00:41 -0600 )edit

Now, i'm trying build in DEBUG mode (BUILD_SHARED_LIBS set off) ...

Result: ========== Build: 55 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

and result of build the INSTALL:

========== Build: 55 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

but still doesn't work...

adamsss gravatar imageadamsss ( 2016-02-22 08:25:20 -0600 )edit

sorry for the confusion, you're meant to build in RELEASE mode only

berak gravatar imageberak ( 2016-02-22 08:30:20 -0600 )edit

both in RELEASE mode?

adamsss gravatar imageadamsss ( 2016-02-22 08:33:38 -0600 )edit