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

Running Hello Query Sample.py in VS2019

NetSpin28
Beginner
1,512 Views

I am trying to run the hello_query_device.py sample from within VS2019.

When it gets to the statement on line 2:

from openvino.inference_engine import IECore

it throws an error: no module named 'openvino'

I am using PYthon 3.7, and this environment has openvino(2021.2) loaded.

I know it's probably something to do with the environmenet variable but I don't see any references to loading and environment variable to find openvino if you are using VS2019.

Any ideas?

0 Kudos
1 Solution
Iffa_Intel
Moderator
1,443 Views

Hi,


Indeed, you need to run the setupvars in the interface that you are using(eg:cmd or visual studio terminal,etc).

Otherwise, you won't be able to do inferencing or even run a simple demo as the OpenVINO packages are not linked together as per setupvars function.


Sincerely,

Iffa


View solution in original post

0 Kudos
8 Replies
Iffa_Intel
Moderator
1,496 Views

Greetings,


This is how you can create your own project in OpenVINO suing visual studio:

https://www.youtube.com/watch?v=_z_YYanhE2I



Sincerely,

Iffa


0 Kudos
NetSpin28
Beginner
1,486 Views
Iffa,
Thank you for your kind reply.
The video is very informative.
I work in Python. There is a python Hello_Query_Device sample but no instructions on how to build it. The instructions stop at building the C++ samples. I can bring the .py files into a VS2019 project that I created but when I try and run it, it can find an openvino module, even though it does exist in my environment as shown below:
NetSpin28_0-1612888532958.png

 

There are no solution files in my directories for openvino.

 
 
0 Kudos
Iffa_Intel
Moderator
1,470 Views

Hi,


For Python samples or demos you should be able to run as it is compiled through an interpreter unlike the C++ which is pre-compiled.


You may refer here: https://docs.openvinotoolkit.org/latest/openvino_inference_engine_ie_bridges_python_sample_hello_query_device_README.html



Sincerely,

Iffa



0 Kudos
NetSpin28
Beginner
1,467 Views

Iffa,

Thank you for your kind reply. I realize it's like teaching string theory to a five year old but I feel I have made some progress. Running the Hello_Query sample in a command window gives the same result as running it from VS2029. It hits the "import openvino" statement and throws an error "no module openvino found" attached please find a copy of the text in the command window.

regards,

netspin

0 Kudos
NetSpin28
Beginner
1,461 Views

Eureka! Surprise to no one. If I run setupvars.bat in the same command window before running the sample hello_query_device.py, it runs fine generating a whole bunch of output I have yet to interpret. When I connect my Neural Compute Stick 2, it also detects that as a Myriad device.

Now all I have to figure out is how to do the same thing inside of Visual Studio 2019.

0 Kudos
Iffa_Intel
Moderator
1,444 Views

Hi,


Indeed, you need to run the setupvars in the interface that you are using(eg:cmd or visual studio terminal,etc).

Otherwise, you won't be able to do inferencing or even run a simple demo as the OpenVINO packages are not linked together as per setupvars function.


Sincerely,

Iffa


0 Kudos
NetSpin28
Beginner
1,439 Views

Iffa,

thank you for your kind reply.

what i realize now is that I can use VS2019 as my IDE to construct the python programs using calls to openvino. The programs then need to be run in a command window following calls to setupvars.bat, or demo_speech_recognition.bat, whatever is appropriate.

Thank you for your assistance.

I will mark this as closed.

0 Kudos
Iffa_Intel
Moderator
1,425 Views

Greetings,


Glad to hear that.


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


Sincerely,

Iffa


0 Kudos
Reply