ImportError: DLL load failed (CUDA + OpenCV on Win10 x64 for Python)

I tried installing the library based on the steps mentioned here:
install opencv on windows

When I tried importing the library, I got the error
ImportError: DLL load failed while importing cv2: The specified module could not be found.

Any ideas on how to solve the issue, I would appreciate if I can do it without building from source, as I am not a developer.

maybe you’re just a

pip install opencv-contrib-python

away …

Thank you, I looked into this and the opencv gpu as well,
those are not what I consider a useful one because they are CPU bre-built binaries only
I would expect the official one (since it is mentioned on the website it is optimized) to use the GPU.
I only have access to radeon gpu on my machine so CUDA is not useful.


you can still use GPUMat (opencl) even from python
(however, IF you need CUDA, you must build from src)

Thank you for your reply,
Yes, I do need the CUDA support, as the application is going to be distributed on a machine with Nividia GPU. However, for the application development, I do need to use it on Radeon GPU (which is the one I have)

Will try to compile from source and see how it works!
Thank you.

OpenCL works on NVIDIA too. the software itself doesn’t require that you use CUDA.

OpenCV can use CUDA either from CUDA-specific modules (contrib repo) or from the dnn module, as one of the backends.

OpenCV’s dnn module doesn’t do training, just inference. it has various backends you can choose from… so you can develop on your AMD card with cuda, and if that works in principle, then you can switch the dnn to use a CUDA backend. should be fairly transparent.

maybe there are OpenCV-python packages out there that come with CUDA… but those are neither official nor by conda-forge (the only unofficial builds I know that aren’t just one-off abandonware)

you’ll have to build OpenCV yourself. the cuda modules live in the contrib repo, so you’ll have to get that and specify OPENCV_EXTRA_MODULES_PATH

“DLL load failed” issues come from, most likely, some CUDA DLLs not being listed in the PATH environment variable, and so the python process can’t find it.

build still succeeds because linking (a build step) requires libraries, not DLLs.

you could browse the cuda tag in this forum. you aren’t the first with this problem and there are very likely solutions or at least hints.

This sounds like it will be a nightmare to debug. How do you intend to make sure your code does what you expect that on a machine without an Nvidia GPU?