In [windows server 2012 R2 x64, python 3.7 64x]
pip install opencv-contrib-python
installed without any error .
and when I try to import it
import cv2
show me this error :
Traceback (most recent call last):
File "test.py", line 1, in <module>
import cv2
File "C:\Program Files\Python37\lib\site-packages\cv2\__init__.py", line 3, in
<module>
from .cv2 import *
ImportError: DLL load failed: The specified module could not be found.
and I see another topic about this error but their solution does not work for me :
- DLL load failed error when importing cv2
- Failure to import cv2 in python : DLL load failed
- and a lot of pages in here
some of them say about that problem because anaconda, and I don't have anaconda even. and many say that problem 32 or 64 version, I try both and disappointment. many about system variables...
what dll
failed to load? cv2? why?
what i try till now:
change python version : 3.5, 3.7, 2.7 in 86x and 64x (uninstall complete last version and delete all remain files in program files ... then install new one)
try with another packages like : opencv-python, opencv-contrib, try install specific versions with .whl (in some topic i read about this so install numpy-1.14.5+mkl-cp37-cp37m-win_amd64.whl and opencv_python-3.4.3+contrib-cp37-cp37m-win_amd64.whl but anything not change)
import numpy before cv2 for every test
installed Microsoft Visual C++ 2015 Redistributable Update 3 , 2008 , 2010 , 2017 for 64x
UPDATE
NEXT 2 DAY
I try to manage missing dll
base on dependency walker that mention in bellow post, download all dll
and put them in system 32, its a good clue but not solve the problem.
DAY 4,5
my next step , trying compile OpenCV in my machine , install visual studio 2012 + cmake and base on document compile 2 version , 64x and 32 , compiling have a lot of problem itself (like missing some lib from c lang and need to install Visual C++ Redistributable for Visual Studio 2012 ...) and I resolve all of them ,then I have 2 success compiled version but both have the same problem with missing dll
, the compile process is so slow and give 2 day from me. so if fail on this mission :/ I search for a new way...
DAY 6
my next step is to try to run OpenCV in my machine with docker ( I try but docker windows just install on windows 10 and windows server 2016) so I search for an alternative. I found Vagrant that work like docker but with VM (visual box) today my time spend for this articles, it's amazing, the concept of docker and vagrant is so Attractive, and I play with this like that I have new puzzle :) first error show on ... and limitless errors go on :
Day 7
Vagrant tests failed too because my windows server 2012 is a vb machine (visual server) and run a visual box in another visual box impossible! so I need new clues :
Day 8-9
try install vagrant with VMware , I download VMware, unfortunately this plugin is not free (79$) so I try to work with pythonanywhere.com that 'gives you access to machines with a full Python environment already installed.' in this free account, you can't openurl with urllib , and more limit... so I wanna try to install ubuntu in VMware my self... I read here results after work. it's Impossible with same reason vb (visual box)
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