Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.

Pyhton DLL load failed by "import cv2"

Toppel__Peter
Novice
1,119 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
1,018 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-o...

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

 

View solution in original post

6 Replies
Syamimi_Intel
Moderator
1,089 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


Toppel__Peter
Novice
1,074 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

 

 

Toppel__Peter
Novice
1,064 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

Toppel__Peter
Novice
1,056 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-st... 

 

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

Toppel__Peter
Novice
1,019 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-o...

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

 

Syamimi_Intel
Moderator
988 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


Reply