Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6392 Discussions

Pyhton DLL load failed by "import cv2"

Toppel__Peter
Novice
5,880 Views

Hello all,

I have just installed the latest OpenVino Toolkit.

There I have selected the installation of opencv and in the meantime also adjusted the environment variables (windows 10). So now Python 3.7.6 finds this when "import cv2".

So almost

 

This message appears:

raceback (most recent call last):

File "<pyshell#0>", line 1, in import cv2 File "C:\Program Files (x86)\Intel\openvino_2021.4.582\python\python3\cv2\__init__.py", line 129, in bootstrap() File "C:\Program Files (x86)\Intel\openvino_2021.4.582\python\python3\cv2\__init__.py", line 112, in bootstrap import cv2 ImportError: DLL load failed: The specified module was not found.

 

I didn't install opencv via pip or something? Is that the reason for the message? or what have I overlooked? 

 

Thanks for any help 

 

0 Kudos
1 Solution
Toppel__Peter
Novice
5,779 Views

Hello everyone,

it's done! Now OpenVino and OpenCV run together on Windows.

After the setupvars.bat always said that everything works. I started python via the cmd environment and imported opencv. Then when checking the version, it says Vino inside.

After this test worked, I read out all the system environment data in Python and then entered it 1:1 in Windows. It is important to execute the readout in the same cmd where you executed setupvars.bat before. This sets a parameter that does not exist otherwise. I then deleted all the parameters (in the environment variable) that are already in Windows and only added the data from Python. PROCEED AT YOUR OWN RISK!

To read out the parameters, here is an example for Python:
https://gist.github.com/bthaman/f7b2b8db006313f73074fe3dcebf0952

You can also do this here at the same time:
https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Access-RTSP-stream-with-OpenCV-4-1-0-openvino/td-p/1154609

Then finally everything works with the OpenVino..5 days have passed.

 

View solution in original post

0 Kudos
6 Replies
Syamimi_Intel
Moderator
5,850 Views

Hi Peter Toppel,

Thank you for reaching out. The error is because of missing python3.dll file. Please download the opencv_python package use the following command:

pip install opencv-python

 

 

Regards,

Syamimi


0 Kudos
Toppel__Peter
Novice
5,835 Views

Hello Syamimi, Hello together,

the soulution with the "pip install opencv-python" it's not working

I have discovered that it could be due to the environment variables.

 

However, when I set the PYTHONPATH as described in the instructions (%INTEL_OPENVINO_DIR%\python\python3.7) I get the following message:

ModuleNotFoundError: No module named 'cv2'

if I change this path:
%INTEL_OPENVINO_DIR%\python\python3

I get the above message.
Whether I have installed opencv via pip or not does not change the message.

 

I've just run out of ideas what I'm doing wrong. Hope someone has another

Peter

 

 

0 Kudos
Toppel__Peter
Novice
5,825 Views

The test result is always:

C:\Program Files (x86)\IntelSWTools\openvino\bin>setupvars.bat
Python 3.7.9
[setupvars.bat] OpenVINO environment initialized

 

I have now downgrade to 2020.3 lts ..the same problem

0 Kudos
Toppel__Peter
Novice
5,817 Views

New test

 

I habe installed opencv with pip and this works..CHECK

After install from OpenVino..opencv not longer working (missing dll)

I have set this all in the Windows,  https://www.intel.com/content/www/us/en/support/articles/000033440/boards-and-kits/neural-compute-sticks.html 

 

I have no more ideas. If anyone else wants to help, I'd be happy to..I'm going to take a break now.

0 Kudos
Toppel__Peter
Novice
5,780 Views

Hello everyone,

it's done! Now OpenVino and OpenCV run together on Windows.

After the setupvars.bat always said that everything works. I started python via the cmd environment and imported opencv. Then when checking the version, it says Vino inside.

After this test worked, I read out all the system environment data in Python and then entered it 1:1 in Windows. It is important to execute the readout in the same cmd where you executed setupvars.bat before. This sets a parameter that does not exist otherwise. I then deleted all the parameters (in the environment variable) that are already in Windows and only added the data from Python. PROCEED AT YOUR OWN RISK!

To read out the parameters, here is an example for Python:
https://gist.github.com/bthaman/f7b2b8db006313f73074fe3dcebf0952

You can also do this here at the same time:
https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Access-RTSP-stream-with-OpenCV-4-1-0-openvino/td-p/1154609

Then finally everything works with the OpenVino..5 days have passed.

 

0 Kudos
Syamimi_Intel
Moderator
5,749 Views

Hi Peter Toppel,

I'm glad that you were able to solve this issue. And, thank you for sharing the answer with us.

 

This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.

 

 

Regards,

Syamimi


0 Kudos
Reply