Article ID: 000058525 Content Type: Troubleshooting Last Reviewed: 02/01/2023

Unable to Run OpenVINO™ Sample in Visual Studio* (VS) 2019

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

How to set up the OpenVINO™ environment within the context of VS2019

Description
  1. Tried to run an OpenVINO™ sample from within VS2019
  2. Encountered error: no module named 'openvino'
Resolution

The OpenVINO™ environment variables must be set before running an OpenVINO™ application. Run setupvars.bat in the terminal or environment in which the program will run.

Follow the OpenVINO™ installation guide

There are two options to implement this with VS2019:

Option 1:

VS2019 Developer Powershell

  1. Open <your sample> from OpenVINO™ folder in VS2019
  2. Create backup file of the code if necessary
  3. Set <your sample> as startup item
  4. Run setupvars.bat in the VS2019 Developer Powershell
  5. Run the sample application

Option 2:

Automate the OpenVINO™ setupvars.bat and VS2019 initialization using batch file

  1. Create a batch file that initializes the OpenVINO™ environment and opens VS2019
  2. Write the script below in the .bat file:
    @echo on
    cd <OpenVINO location>\bin
    CALL setupvars.bat
    cd <Microsoft Visual Studio location>\2019\Community\Common7\IDE
    CALL devenv.exe
  3. Run the .bat file as administrator
  4. After the VS2019 opens, select <your sample> from OpenVINO™ folder
  5. Create backup file if necessary
  6. Set <your sample> as startup item
  7. Run the sample application

Related Products

This article applies to 2 products