Opencv-Python built for Windows x64 Python 3.7, .pyd file not found, OpenCV modules unavailable

asked 2020-04-21 13:42:12 -0600

hant gravatar image

I'm trying to build opencv-python with cuda. Despite following a few guide, i still can't get it.

https://answers.opencv.org/question/2...

https://lightbuzz.com/opencv-cuda/

https://docs.opencv.org/master/d5/de5...

As per berak's suggestion, I still can't seems to get the OpenCV module for python.

I'm configuring it with CMake GUI and OpenCV Modules shows that python3 is unavailable image description

I have install the required python packages...

>pip list
Package           Version
----------------- -------
astroid           2.3.3
beautifulsoup4    4.9.0
colorama          0.4.3
entrypoints       0.3
flake8            3.7.9
imutils           0.5.3
isort             4.3.21
lazy-object-proxy 1.4.3
mccabe            0.6.1
numpy             1.18.3
pip               20.0.2
pycodestyle       2.5.0
pyflakes          2.1.1
pylint            2.4.4
setuptools        41.2.0
six               1.14.0
soupsieve         2.0
typed-ast         1.4.1
wheel             0.34.2
wrapt             1.11.2

So, what else am I missing? I lost.

.......................................................................................

The full output of the CMake result...

Detected processor: AMD64
libjpeg-turbo: VERSION = 2.0.2, BUILD = opencv-4.2.0-libjpeg-turbo
found Intel IPP (ICV version): 2019.0.0 [2019.0.0 Gold]
at: C:/Users/HANINN/Documents/Git/opencv-4.2.0/build/3rdparty/ippicv/ippicv_win/icv
found Intel IPP Integration Wrappers sources: 2019.0.0
at: C:/Users/HANINN/Documents/Git/opencv-4.2.0/build/3rdparty/ippicv/ippicv_win/iw
CUDA detected: 10.2
CUDA NVCC target flags: -gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-D_FORCE_INLINES
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find BLAS (missing: BLAS_LIBRARIES) 
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
OpenCV Python: during development append to PYTHONPATH: C:/Users/HANINN/Documents/Git/opencv-4.2.0/build/python_loader
Caffe:   NO
Protobuf:   NO
Glog:   NO
freetype2:   NO
harfbuzz:    NO
Module opencv_ovis disabled because OGRE3D was not found
No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Tesseract:   NO
Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': C:/Users/HANINN/Documents/Git/opencv-4.2.0/opencv-4.2.0/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn ...
(more)
edit retag flag offensive close merge delete

Comments

1

Can you share your cmake command?

Are you passing -DBUILD_opencv_python3=ON and specifying the locations of your python install

-DPYTHON3_INCLUDE_DIR=%pathToAnaconda%/include -DPYTHON3_LIBRARY=%pathToAnaconda%/libs/python%pyVer%.lib -DPYTHON3_EXECUTABLE=%pathToAnaconda%/python.exe -DPYTHON3_NUMPY_INCLUDE_DIRS=%pathToAnaconda%/lib/site-packages/numpy/core/include -DPYTHON3_PACKAGES_PATH=%pathToAnaconda%/Lib/site-packages/

as detailed in Accelerate OpenCV 4.3.0 – build with CUDA and python bindings

cudawarped gravatar imagecudawarped ( 2020-04-22 05:37:22 -0600 )edit
1

Thank you for your assistant and the write up on your page.

I follow your checklist, but without much success. Python 3 still classified as unavailable in the OpenCV modules. The CMake GUI cache file and CMake Output

...........................

The CMake command which I configure previously with opencv 4.2 here and Image another link to all the python configuration

...........................

What am I missing out here?

hant gravatar imagehant ( 2020-04-22 12:54:04 -0600 )edit
1

Are you configuring through the cmake gui? If so I would suggest passing the arguments through the command line. From your output it looks like the python config is not complete, specifically Libraries is missing. I get the following cmake output when passing the above PYTHON3 switches to cmake

--   Python 3:
--     Interpreter:                 C:/Users/mbironi/Anaconda3/python.exe (ver 3.7.6)
--     Libraries:                   C:/Users/mbironi//Anaconda3//libs/python37.lib (ver 3.7.6)
--     numpy:                       C:/Users/mbironi//Anaconda3/Lib/site-packages/numpy/core/include (ver )
--     install path:                C:/Users/mbironi//Anaconda3/Lib/site-packages

Can also confirm that you are deleting the build directory every time you change the config?

cudawarped gravatar imagecudawarped ( 2020-04-23 03:23:22 -0600 )edit

Surprisingly I managed to get the Python 3 output similar to yours. Let me build them and hopefully the will be something.

I looked into all the python 3 cmake parameters. Indeed in the Cmake cache file, the Python 3 Libraries can't be found, despite the paths being provided. I followed here and added all the parameters Image.

hant gravatar imagehant ( 2020-04-23 10:43:27 -0600 )edit
1

Yes finally it's here!. It's found inside my "opencv-4.3.0\build\lib\python3\Release" cv2.cp37-win_amd64.pyd :') Many thanks!

hant gravatar imagehant ( 2020-04-24 00:50:30 -0600 )edit