opencv / opencv/opencv-python

ImportError: DLL load failed while importing cv2

Open
#978 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

incomplete
Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

I have a problem "ImportError: DLL load failed while importing cv2: The specified module could not be found"

Information about my attempted installation
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
MSVC: Microsoft Visual Studio 2019
OS: Win 10
CMake gui: 3.29.2
Source cv2 files version: 4.5.0

I'm compiling opencv from source and it's all working fine, but when instantiating cv2, I get the "Import DLL .... " error occurred.
Python 3.8.10 opencv 4.5.0 opencv_contrib-4.5.0

What is the DLL file that failed to load? Why is this happening?
Also I would like to know if it is possible to make opencv implement CUDA acceleration by compiling opencv source code in the python case. If it is possible how to implement it?

Thank you,
Anthony of Sydney

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the cv2 import failure with the stated Python, Windows, CMake, and source-build versions, then inspect the generated DLL dependencies to identify what cannot be loaded. Review the build configuration for CUDA support and verify that the resulting Python module imports successfully and reports CUDA availability.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, python
Domain
build-system, computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.