Opencv-python: ImportError: DLL load failed: The specified module could not be found.

Created on 28 Nov 2018  路  4Comments  路  Source: opencv/opencv-python

I have installed opencv using pip install opencv-contrib-python in ActivePython 3.5.4 in * Windows 10*. When I import cv2 module it is throwing error as
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\Yajana\Documents\Python\mechine_learning\env\lib\site-packages\cv2\__init__.py", line 3, in <module> from .cv2 import * ImportError: DLL load failed: The specified module could not be found.

  1. I have Microsoft Visual C++ 2015 Redistributable Installed
  2. I have tried with downloading api-ms-win-downlevel-shlwapi-l1-1-0.dll and placing it in system32 and SysWOW64

What else can be done to resolve the issue?

Most helpful comment

The solution for this issue is to download windows media feature package for the version of windows that I am using.

All 4 comments

These packages are targeted only for the official CPython implementation: https://www.python.org/

Please do not download arbitrary DLL files from the internet. They might contain malware.

First, install all Windows updates to your system. If that does not work, you can try to check the missing dependencies with Dependency Walker.

  1. I have tried with official CPython also getting the same error.
  2. Windows is up to date.
  3. In Dependency Walker when I open cv2.cp35-win_amd64.pyd the log is
    Error: At least one required implicit or forwarded dependency was not found. Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. Error: A circular dependency was detected. Warning: At least one delay-load dependency module was not found. Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

Missing dlls are
API-MS-WIN-*.DLL
EXT-MS-*.DLL
EMCLIENT.DLL
EXT-MS-WIN-*.DLL
MF.DLL
MFPLAT.DLL
MFREADWRITE.DLL

Here are the logs when I import in -v mode

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 697, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "C:\Users\Yajana\Documents\Python\mechine_learning\env\lib\site-packages\cv2\__init__.py", line 3, in <module>
from .cv2 import *
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 938, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

Could you try with https://github.com/lucasg/Dependencies. Its output is easier to read as it does not contain so many false positives.

The solution for this issue is to download windows media feature package for the version of windows that I am using.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Domibor picture Domibor  路  4Comments

zoonoo picture zoonoo  路  3Comments

moneer88 picture moneer88  路  6Comments

gldraphael picture gldraphael  路  6Comments

lgvaz picture lgvaz  路  3Comments