Community
cancel
Showing results for 
Search instead for 
Did you mean: 
NetSpin28
Beginner
174 Views

Running Hello Query Sample.py in VS2019

Jump to solution

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

Accepted Solutions
Iffa_Intel
Moderator
105 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

8 Replies
Iffa_Intel
Moderator
158 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


NetSpin28
Beginner
148 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.

 
 
Iffa_Intel
Moderator
132 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_que...



Sincerely,

Iffa



NetSpin28
Beginner
129 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

NetSpin28
Beginner
123 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.

Iffa_Intel
Moderator
106 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

NetSpin28
Beginner
101 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.

Iffa_Intel
Moderator
87 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