opencv / opencv/opencv-python

ImportError: DLL load failed while importing cv2: The specified module could not be found.

Open
#856 32 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,
I installed opencv-contrib-python 4.7.0.72 using pip for python 3.11.4 on Windows 10 x86-64
But when I run I get this exceptiom DLL load failed while importing cv2: The specified module could not be found.

Expected behaviour

I expect the module to import and not trow an error.

Actual behaviour

This exception gets trown

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python311\Lib\site-packages\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "C:\Python311\Lib\site-packages\cv2\__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing cv2: The specified module could not be found.
Steps to reproduce
  • example code
    import cv2
  • operating system
    Windows 10, i7-12700H with Intel Iris Xe Graphics and a NVIDIA RTX A1000
  • architecture (e.g. x86)
    x86-64
  • opencv-python version
    opencv-contrib-python-4.7.0.72
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python

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

Start by reproducing import cv2 with Python 3.11.4, Windows 10 x86-64, and opencv-contrib-python 4.7.0.72. Read the bootstrap path in cv2/__init__.py and investigate the reported DLL-loading failure in that environment. Done means the package imports successfully without the exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.