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

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.)

About this issue

Most upvoted comments

The instructions are a little out of date, but I believe they would solve the issue Go to Windows -> Settings -> Uninstall/Install Apps Go to Optional Features Go to Add button Look for Windows Media Pack

I have the same problem (Python 3.11)

I got the same problem.