Wednesday, 19 September 2018

"DLL load failed" when import cv2 (opencv)

i spent many hours to solve this problem but i can't find soloution , please any clue that you know share with me.

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 topics about this error but their soloution is 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

please help me.

UPDATE
NEXT 2 DAY
i try 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 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 complied version but both have 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 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 alternative . i found Vagrant that work like docker but with vm (visual box) today my time spend for this articles , its amazing , the concept of docker and vagrant is so Attractive , and i play with this like that i have new puzzle :) fisrt error show on ... and limitless errors is 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 impoissible ! 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 install ubunto in vmware my self... i read here results after work. its Impossible with same reason vb (visual box)



from "DLL load failed" when import cv2 (opencv)

No comments:

Post a Comment