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.

ModuleNotFoundError: No module named 'openvino'

hochi__andre
Beginner
17,998 Views

I have an import error where I can't import from openvino. I ran the installation correctly and ran the two files (demo_squeezenet_download_convert_run.bat and demo_security_barrier_camera.bat) that are required to check if the installation worked fine. But when trying to run classification_sample.py The import error comes up. 

I am running on Windows, python 3.6.5, and do not have a intel GPU.

0 Kudos
20 Replies
Shubha_R_Intel
Employee
17,998 Views

Dear hochi, andre,

Did you run C:\Program Files (x86)\IntelSWTools\openvino_2019.1.148\bin\setupvars.bat first ? Also are you using the latest and greatest OpenVino release - 2019 R1.1 ? 

If you don't have an Intel integrated GPU, that's OK. classification_sample.py by default will run on a CPU.

Thanks,

Shubha

0 Kudos
hochi__andre
Beginner
17,998 Views

Yes I have, I believe that file is supposed to set up the paths. When I run it a screen appears for .1 seconds then disappears.

0 Kudos
hochi__andre
Beginner
17,998 Views

But I still have the import error.

0 Kudos
hochi__andre
Beginner
17,998 Views

Also Yes I am running OpenVino 2019 R1.1

 

0 Kudos
hochi__andre
Beginner
17,998 Views
0 Kudos
Shubha_R_Intel
Employee
17,998 Views

Dear hochi, andre,

So you are running Windows 10 right ? From a command shell (DOS) after you run setupvars.bat, please type echo %PYTHONPATH% . Please post the result here.

Thanks,

Shubha

0 Kudos
XWang97
Beginner
17,997 Views

Hi.

I have run: "C:\Program Files (x86)\IntelSWTools\openvino\bin\setupvars.bat".

And I got:

Python 3.6.4
ECHO is off.
PYTHONPATH=C:\Program Files (x86)\IntelSWTools\openvino\python\pythonprogram.or;C:\Program Files (x86)\IntelSWTools\openvino\python\pythonprogram.or
[setupvars.bat] OpenVINO environment initialized

But I still get: ModuleNotFoundError: No module named 'openvino', because of  from openvino.inference_engine import IENetwork, IEPlugin

0 Kudos
STyur
New Contributor I
17,997 Views

"C:\Program Files (x86)\IntelSWTools\openvino\bin\setupvars.bat" have to be run from command prompt window each time as you open cmd.

then, after that, you can run 'python3 classification_sample.py' in this cmd window

0 Kudos
Kurniatul__Faiqoh
17,997 Views

Hi, have you solved the problem? Maybe the execution of setupvars.bat hadn't taken effect yet. Have you checked whether the environment variables had been all set? Try to run it again and log off then log in again then check your environment variables. if the same problem still occurs maybe you should check out this link and set the variables manually.

0 Kudos
Shubha_R_Intel
Employee
17,997 Views

Hello everyone, 

OpenVino 2019R2 just got released yesterday. Please download it and give it a try !

Thanks,

Shubha

0 Kudos
Zorrilla_Cepeda__Pab
17,997 Views

I've followed all the installation instructions for Ubuntu and it has this problem. setupvars are already set and working. What should I do now?

0 Kudos
Zorrilla_Cepeda__Pab
17,997 Views
I have this problem with ubuntu. setupvars.sh was executed so the problem comes from somewhere else.

[setupvars.sh] OpenVINO environment initialized
pabloz@pabloz-HP-Laptop:~/desarrollo/safety-gear-detector-python/application$ python3 -c "import cv2; print(cv2.__version__)"
4.2.0-openvino
pabloz@pabloz-HP-Laptop:~/desarrollo/safety-gear-detector-python/application$ python3 -c "import openvino; print(openvino.__version__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'openvino' has no attribute '__version__'
pabloz@pabloz-HP-Laptop:~/desarrollo/safety-gear-detector-python/application$ sudo python3 ./safety_gear_detector.py -d CPU -m /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/intel/person-detection-retail-0013/FP32/person-detection-retail-0013.xml -sm ../resources/worker-safety-mobilenet/FP32/worker_safety_mobilenet.xml -e /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/libcpu_extension_avx2.so
Traceback (most recent call last):
  File "./safety_gear_detector.py", line 33, in <module>
    from inference import Network
  File "/home/pabloz/desarrollo/safety-gear-detector-python/application/inference.py", line 28, in <module>
    from openvino.inference_engine import IENetwork, IECore
ModuleNotFoundError: No module named 'openvino'

Also, the "rich text" formatting options of this website to share these lines are terrible.

0 Kudos
Ba_Van__Nguyen
Beginner
17,997 Views

 

Have you solved this error yet? How did you do it? I also have the same problem

0 Kudos
Zorrilla_Cepeda__Pab
17,997 Views

Not working. What am I missing?

[setupvars.sh] OpenVINO environment initialized
pabloz@pabloz-HP-Laptop:~/desarrollo/safety-gear-detector-python/application$ python3 -c "import cv2; print(cv2.__version__)"
4.2.0-openvino
pabloz@pabloz-HP-Laptop:~/desarrollo/safety-gear-detector-python/application$ python3 -c "import openvino; print(openvino.__version__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'openvino' has no attribute '__version__'
pabloz@pabloz-HP-Laptop:~/desarrollo/safety-gear-detector-python/application$ sudo python3 ./safety_gear_detector.py -d CPU -m /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/intel/person-detection-retail-0013/FP32/person-detection-retail-0013.xml -sm ../resources/worker-safety-mobilenet/FP32/worker_safety_mobilenet.xml -e /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/libcpu_extension_avx2.so
Traceback (most recent call last):
  File "./safety_gear_detector.py", line 33, in <module>
    from inference import Network
  File "/home/pabloz/desarrollo/safety-gear-detector-python/application/inference.py", line 28, in <module>
    from openvino.inference_engine import IENetwork, IECore

0 Kudos
Ba_Van__Nguyen
Beginner
17,997 Views

Hi.

I have run: "C:\Program Files (x86)\IntelSWTools\openvino\bin\setupvars.bat".

And i got:

 Python 3.7.6
ECHO is off.
PYTHONPATH=C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\open_model_zoo\tools\accuracy_checker;C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\python\python3.7;C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\python\python3;
[setupvars.bat] OpenVINO environment initialized

But I still get: ModuleNotFoundError: No module named 'openvino'.

I have tried on many versions but none of them solved the problem. Please help me

 

0 Kudos
mohamed__tamer
Beginner
17,997 Views

if you are using visual studio code, open your project , go to cmd terminal and run the setupvars.bat file you run in the cma

0 Kudos
iconnor
Beginner
17,998 Views

Having the same problem.  ubuntu 18.04

/opt/intel/openvino/bin/setupvars.sh 
[setupvars.sh] OpenVINO environment initialized
echo $PYTHONPATH

nothing is printed.  env shows no variables set specific to openvino.  The setupvars.sh script is not having any effect.

0 Kudos
iconnor
Beginner
17,999 Views

Fixed it. Instead of running /opt/intel/openvino/setupvars.sh, you have to source it.

source /opt/intel/openvino/setupvars.sh

echo $PYTHONPATH
/opt/intel/openvino_2020.2.120/python/python3.6:/opt/intel/openvino_2020.2.120/python/python3:/opt/intel/openvino_2020.2.120/deployment_tools/open_model_zoo/tools/accuracy_checker:/opt/intel/openvino_2020.2.120/deployment_tools/model_optimizer:/opt/intel/openvino_2020.2.120/data_processing/dl_streamer/python:/opt/intel/openvino_2020.2.120/data_processing/gstreamer/lib/python3.6/site-packages:/opt/intel/openvino_2020.2.120/python/python3.6:/opt/intel/openvino_2020.2.120/python/python3:/opt/intel/openvino_2020.2.120/deployment_tools/open_model_zoo/tools/accuracy_checker:/opt/intel/openvino_2020.2.120/deployment_tools/model_optimizer:/opt/intel/openvino_2020.2.120/data_processing/dl_streamer/python:/opt/intel/openvino_2020.2.120/data_processing/gstreamer/lib/python3.6/site-packages:

zian123
Novice
11,608 Views

Hi I am facing the same problem as "No Module named Openvino", But I dont know how to fix it. Can you please tell me how you fixed that. I dint get your solution,

 Instead of running /opt/intel/openvino/setupvars.sh, you have to source it.

source /opt/intel/openvino/setupvars.sh

How to do this? where to right this?

Thanks

0 Kudos
GauthierSornet
Beginner
2,762 Views

Even it is an old topic, I solved this problem for a raspberry pi by taking care of the linux xxbits version according to the openvino xxbits version.

I my case, i setup an 64bits 2023-05-03-raspios-bullseye-arm64.img.xzand then a 64bits openvino and it works perfectly. Dont forget to use "source" to run the setupvars.sh

 

Have fun.

0 Kudos
Reply