I have been trying to install opencv 4.5.1 with cuda support on my windows 10 machine. Following guides at https://jamesbowley.co.uk/accelerate-opencv-4-5-0-on-windows-build-with-cuda-and-python-bindings and https://haroonshakeel.medium.com/build-opencv-4-5-1-with-gpu-cuda-support-on-windows-10-without-tears-cf0e55dc47f9
I had it working under an Anaconda environment but I wanted to try and eliminate Anaconda from the mix so I re created (make and build / install) without using an Anaconda environment and the result doesnt work. it gets
ImportError: DLL load failed while importing cv2: The specified module could not be found.
I have fed my resultant cv2.cp38-win_amd64.pyd into Dependencies and dependency walker and nothing jumps out
The old dependancy walker only found 2 modules with no path HVSIFILETRUST.DLL IESHIMS.DLL but these are still there on the working version too.
(other than everything with API-MS-WIN-* and EXT-MS-WIN) the newer Dependencies didnt seem to find anything useful.
Both worlds are using Pyhon 3.8
Non-Anaconda = Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Anaconda = Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
using James Troubleshooting tips https://jamesbowley.co.uk/accelerate-opencv-4-5-0-on-windows-build-with-cuda-and-python-bindings/#troubleshooting
where opencv_world451.dll
where opencv_img_hash451.dll
where nppc64_11.dll
where cudnn64_8.dll
all report valid modules AND the exact same modules are reported in and out of Anaconda environment
My theory is that there is something in the Anaconda 'environment', probable the Python environment that enables this to work
I started to debug by 'trimming' the anaconda environment but there are over 400 packages
plus I have a lot of confusion over what python -m pip list shows (about 215 things) and
what help("modules") shows. Just over 700 in the anaconda env vs 315 in my normal non-anaconda world
so thats over 400 modules/packages to sort through.
Then a lot of these things cannot apparently be removed - eg the whole 'brain' set of modules, dont know what they do but they have names that make them suspects
Haroon's post only seems to work under Anaconda but there is no reason why this should be so. It seems just a personal preference.
Any Ideas ? Thanks JC
Ok I give up. Thats about 20 builds with all the different combinations of OpenCV versions, Python versions, Building with and without static libraries, with and without the 'world'. With anaconda installed but not used and with anaconda completley uninstalled. The result is always the same
import cv2
ImportError: DLL load failed while importing cv2: The specified module could not be found.
That is any attempt to re-build Open-CV WITHOUT Anaconda fails. And when you look at the resultant file (something like 'cp38-win_amd64.pyd') in Dependancies there are no missing modules except some obscure things deep in the windows tree
So it doesnt want to play and wont let me into its secrets so I will just have to live without CUDA thats 2304 cuda cores going to waste! but the more I think about it the less I want Anaconda in the mix on what is essentially my office computer. JC