Dll Load Failed Error When Importing Cv2

DLL load failed error when importing cv2

You can download the latest OpenCV 3.2.0 for Python 3.6 on Windows 32-bit or 64-bit machine, look for file starts withopencv_python‑3.2.0‑cp36‑cp36m, from this unofficial site. Then type below command to install it:

  • pip install opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl (32-bit version)
  • pip install opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl (64-bit version)

I think it would be easier.

Update on 2017-09-15:

OpenCV 3.3.0 wheel files are now available in the unofficial site and replaced OpenCV 3.2.0.

Update on 2018-02-15:

OpenCV 3.4.0 wheel files are now available in the unofficial site and replaced OpenCV 3.3.0.

Update on 2018-06-19:

OpenCV 3.4.1 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support, and replaced OpenCV 3.4.0.

Update on 2018-10-03:

OpenCV 3.4.3 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support, and replaced OpenCV 3.4.1.

Update on 2019-01-30:

OpenCV 4.0.1 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support.

Update on 2019-06-10:

OpenCV 3.4.6 and OpenCV 4.1.0 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support.

DLL load failed when import cv2 (opencv)

This can happen if you are using windows 10 N distribution, the N distributions does not come pre installed with windows media feature pack, which is required after OpenCV version 3.4 and onwards.

The preferred solution is to install the feature pack at : https://www.microsoft.com/en-us/software-download/mediafeaturepack

Be careful to choose the version that works with your current version of windows.

If that is not an option, fall back to an earlier version of OpenCV that does not have dll dependencies, you can do that by:pip install opencv-python=3.3.0.9

Since windows rolled out it's N version this problem has been seen at many places, and has many impacts across the windows environment, the fastest way to identify if you have this problem is open youtube in Edge browser, if it says HTML5 media plugin not found, this is the problem.

Update May 2020: There is a new way to install media pack for Windows 10 N.

https://support.microsoft.com/en-us/help/4562569/media-feature-pack-for-windows-10-n-may-2020

OpenCV-Python ImportError: DLL load failed: The specified module could not be found

You may try this conda install command for installing OpenCV 3.2.0 for Python 3.6. The conda-forge repository does have OpenCV 3.2.0 binary for 32-bit and 64-bit Windows.

conda install -c conda-forge opencv=3.2.0

If you need opencv_contrib modules, you can download the binary from this unoffice website and install it to Anaconda through pip install.

  • pip install opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win32.whl (x86 Win)
  • pip install opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl (x64 Win)

Take note the package installed by pip will not be shown by conda list command.

Then type import cv2 in command prompt to verify if the installation is success as below.
Sample Image

If you have problem on import cv2, double check Windows Environment Variables setup as below.

  1. OPENCV_DIR points to your OpenCV executable files, e.g. C:\Program Files\OpenCV 3.2.0\x64\vc14
  2. PATH=%PATH%;%OPENCV_DIR%\bin

How to remove the error : ImportError: DLL load failed: The specified module could not be found. while importing cv2 in jupyter notebook

Assuming you really need the contrib module, for the error you specified,

try this:

1. make sure you have Visual C++ redistributable 2015 installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, Universal C Runtime might be also required.

Contrib document on pip clearly mentions this to be installed as a prerequisite.

2. If you still encounter the error after you have checked all the previous solutions, download Dependencies and open the cv2.pyd (located usually at C:\Users\username\AppData\Local\Programs\Python\PythonXX\Lib\site-packages\cv2) file with it to debug missing DLL issues.

Dependencies.

Use the second solution if fails again.

Post me on the comment section if it works and accept this as a solution or otherwise let me know.

Can't import cv2; DLL load failed

In my situation, when using Pycharm to import cv2, it returned ImportError: DLL not found. However, using python intepreter to import I got *ImportError: ... not a win32 DLL ... * instead. So, in this situation, I had to download Visual C++ 2015 redistribution package and problem solved.

So to anyone who meets the same error, please make sure you have the VC++ redistribution package which was used to compile the DLL packed along the module.



Related Topics



Leave a reply



Submit