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.

OpenCV with OpenVino

Khan__Shaan
Beginner
2,203 Views

Hey, I just recently installed OpenVINO on the windows 10 platform following this tutorial. https://software.intel.com/en-us/articles/OpenVINO-Install-Windows however, once I attempt to use OpenCV on python I'm unable to do so. The error I get is:

    import cv2
ModuleNotFoundError: No module named 'cv2'

From the kit it says OpenCV should be installed, is there something I'm missing?

Thanks for your help in advance, Shaan K

0 Kudos
8 Replies
whatthisismyname
Beginner
2,203 Views

you need to install openCV on your pc, the OpenVINO does install latest release 4.0.1 i think. This has mods for Intel CPU's so you may want to reinstall openvino and make sure you follow the instructions. Its a pretty good toolkit that takes care of everything so you are doing something wrong, Read the manual :)

0 Kudos
Khan__Shaan
Beginner
2,203 Views

I've tried installing this toolkit several times now with fresh python installs using python 3.6.5 in addition to uninstalling and re-installing the OpenVino toolkit, however, I'm still unable to access openCV via the installation, would you know of any way of fixing it or assuming what I did wrong. I'm certain, I've followed the tutorial line by line. 

0 Kudos
Dmitry_K_Intel3
Employee
2,203 Views

@Khan, Shaan, Please check that your Python is 64bit at first. If so, please share the output of setupvars.sh (C:\Intel\computer_vision_sdk_2018.5.445\bin\setupvars.bat).

0 Kudos
Payette__Mathieu
Beginner
2,203 Views

Having the same problem here, trying to use the prebuilt OpenCV from OpenVINO on Anaconda env with python 3.6.

0 Kudos
Payette__Mathieu
Beginner
2,203 Views

Dmitry Kurtaev (Intel) wrote:

@Khan, Shaan, Please check that your Python is 64bit at first. If so, please share the output of setupvars.sh (C:\Intel\computer_vision_sdk_2018.5.445\bin\setupvars.bat).

Could you please provide an example of what that script is supposed to output ? On my side I get:

PYTHONPATH=C:\Intel\computer_vision_sdk_2018.5.456\python\python3.6;C:\ProgramData\Anaconda3\envs\OpenVino;
[setupvars.bat] OpenVINO environment initialized

 

0 Kudos
Chen__Cheng
Beginner
2,203 Views

I got one question when came crossing this topic. Is it possible to get OpenCV-OpenVino or just OpenVino through pip install or conda install? I tried a bit but with no luck..

@Payette

How did you get Openvino in your conda env?

0 Kudos
Shubha_R_Intel
Employee
2,204 Views

Dearest Chen, Cheng,

At this time OpenVino is not installable through Conda. Maybe at some point in the future, this will change. I don't see a reason however that OpenVino couldn't work with Conda's installation of Python 3.6.5. If you add these paths (Conda's variant of these paths) to your PATH variable:

 C:\Users\sdramani\AppData\Local\Programs\Python\Python36\Scripts\ 

C:\Users\sdramani\AppData\Local\Programs\Python\Python36\

OpenVino should have no problem ! OpenVino installation is actually de-coupled from the Python installation so as long as your paths are setup correctly, everything should work. Be careful not to have conflicting paths though - which can happen when you have several site-packages all over your machine and several Pythons in your PATH variable. Much of OpenVino's documentation which depends on Python (like Model Optimizer) recommends using Python Python Virtual Environments actually, to avoid Python version conflict issues.

You can certainly get a new version of OpenCV though, and use it with your OpenVino installation. Many customers have done this in fact. Please carefully inspect your setupvars.sh and pay attention to the following section (I'm posting an excerpt for the Windows setupvars.bat but for Linux it should be similar):

:: OpenCV
if exist "%INTEL_OPENVINO_DIR%\opencv\setupvars.bat" (
call "%INTEL_OPENVINO_DIR%\opencv\setupvars.bat"
) else (
set "OpenCV_DIR=%INTEL_OPENVINO_DIR%\opencv\x64\vc14\lib"
set "PATH=%INTEL_OPENVINO_DIR%\opencv\x64\vc14\bin;%PATH%"
)

What you must do is set OpenCV_DIR to point to your OpenCV installation lib directory.

Hope it helps,

Thanks,

Shubha

0 Kudos
Shubha_R_Intel
Employee
2,204 Views

Dear folks,

Allow me to mention something else which is important (regarding the relationship between Python installation and OpenVino):

There is nothing inherently wrong with using a Conda installation of Python with OpenVino - OpenVino theoretically should not care, as long as you get your PATH setup correctly. Our official installation instructions do not mention Conda but I can't see why a Conda Python installation would be problematic for OpenVino. The only issue is, your life may be harder - all of the MO and other Python tools use requirements.txt to install prerequisites.  Apparently you can do something similar with Conda according to this Stack Overflow question. It's not impossible but it will be more inconvenient, if you use Conda.

Thanks for using OpenVino !

Shubha

0 Kudos
Reply