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.
6404 Discussions

Windows - ModuleNotFoundError: No module named 'openvino'

rcotton
Employee
4,663 Views

 

Installed Intel® Distribution of OpenVINO™ Toolkit -  w_openvino_toolkit_p_2021.3.394,  python 3.7.4, Visual Studio Community 2019 installing the C++ and CMake libraries.

 

Set Environmental Variables:

cd "C:\Program Files (x86)\Intel\openvino_2021\bin\"
.\setupvars.bat

 

Install Pre-Requisites:

cd "C:\Program Files (x86)\Intel\openvino_2021\deployment_tools\model_optimizer\install_prerequisites"
.\install_prerequisites.bat

 

Download Benchmark Model:

cd ..\..\tools\model_downloader

python .\downloader.py --name mobilenet-v2 --output_dir C:\Users\User\Desktop\Models\

 

Model Optimizer to FP16 (ran successfully):

python .\mo.py --input_model C:\Users\User\Desktop\Models\public\mobilenet-v2\mobilenet-v2.caffemodel --data_type FP16 --output_dir C:\Users\User\Desktop\Models\public\mobilenet-v2\ir

 

Output for Model Optimizer:

Model Optimizer arguments:
Common parameters:
- Path to the Input Model: C:\Users\User\Desktop\Models\public\mobilenet-v2\mobilenet-v2.caffemodel
- Path for generated IR: C:\Users\User\Desktop\Models\public\mobilenet-v2\ir
- IR output name: mobilenet-v2
- Log level: ERROR
[...]
- Inference Engine found in: C:\Program Files (x86)\Intel\openvino_2021\python\python3.7\openvino
Inference Engine version: 2.1.2021.3.0-2787-60059f2c755-releases/2021/3
Model Optimizer version: 2021.3.0-2787-60059f2c755-releases/2021/3
[ SUCCESS ] Generated IR version 10 model.
[ SUCCESS ] XML file: C:\Users\User\Desktop\Models\public\mobilenet-v2\ir\mobilenet-v2.xml
[ SUCCESS ] BIN file: C:\Users\User\Desktop\Models\public\mobilenet-v2\ir\mobilenet-v2.bin
[ SUCCESS ] Total execution time: 77.89 seconds.

 

Run benchmark_app.py (failed):

cd "C:\Program Files (x86)\Intel\openvino_2021.3.394\deployment_tools\tools\benchmark_tool"
python benchmark_app.py -m C:\Users\User\Desktop\Models\public\mobilenet-v2\mobilenet-v2.caffemodel

 

Output from benchmark_app.py:

Traceback (most recent call last):
File "benchmark_app.py", line 20, in <module>
from openvino.tools.benchmark.main import main
ModuleNotFoundError: No module named 'openvino'

 

Attempted to install openvino from pip:

pip install --upgrade openvino Collecting openvino
Downloading openvino-2021.3.0-2774-cp37-cp37m-win_amd64.whl (20.6 MB)
|████████████████████████████████| 20.6 MB 3.3 MB/s
Requirement already satisfied: numpy>=1.16.3 in c:\users\user\appdata\roaming\python\python37\site-packages (from openvino) (1.18.5)
Installing collected packages: openvino
Successfully installed openvino-2021.3.0

 

Output - Reran benchmark_app.py with new import error: 

Traceback (most recent call last):
File "benchmark_app.py", line 20, in <module>
from openvino.tools.benchmark.main import main
ModuleNotFoundError: No module named 'openvino.tools'

 

Unsure how to proceed with executing the benchmark_app.py or if installing openvino from pip was proper.  Any assistance or guidance would be helpful - attempting to run several benchmarks.  Thank you.

0 Kudos
1 Solution
Wan_Intel
Moderator
4,641 Views

Hi Rcotton,

Thank you for reaching out to us.


The error you encountered ModuleNotFoundError: No module named 'openvino' probably due to you did not set up the environment variables in a new terminal.


Please run setupvars.bat every time you open a new terminal.


Before you run the benchmark_app.py, please change the directory to:

<INSTALL_DIR>\deployment_tools\tools\benchmark_tool and install the requirements by executing the command:

pip install -r requirements.txt


On the other hand, I noticed you run benchmark_app.py with mobilenet-v2.caffemodel. Please use the XML file that you have generated which is located at:

C:\Users\User\Desktop\Models\public\mobilenet-v2\ir\mobilenet-v2.xml


Please try the following command after you have set up the environment variables:

python benchmark_app.py -m <PATH_TO_XML file>\mobilenet-v2.xml



Regards,

Wan


View solution in original post

2 Replies
Wan_Intel
Moderator
4,642 Views

Hi Rcotton,

Thank you for reaching out to us.


The error you encountered ModuleNotFoundError: No module named 'openvino' probably due to you did not set up the environment variables in a new terminal.


Please run setupvars.bat every time you open a new terminal.


Before you run the benchmark_app.py, please change the directory to:

<INSTALL_DIR>\deployment_tools\tools\benchmark_tool and install the requirements by executing the command:

pip install -r requirements.txt


On the other hand, I noticed you run benchmark_app.py with mobilenet-v2.caffemodel. Please use the XML file that you have generated which is located at:

C:\Users\User\Desktop\Models\public\mobilenet-v2\ir\mobilenet-v2.xml


Please try the following command after you have set up the environment variables:

python benchmark_app.py -m <PATH_TO_XML file>\mobilenet-v2.xml



Regards,

Wan


Wan_Intel
Moderator
4,627 Views

Hi Rcotton,


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,

Wan


0 Kudos
Reply