Skip to content
Advertisement

Custom Python Remove Interpreter with OpenVINO initialization

I use PyCharm to connect to a remote interpreter (but I guess the answer is somewhat unrelated): basically, PyCharm connects to a remote Python interpreter through SSH and execute the code on a remote machine.

The remote interpreter that I used is actually “tweaked”. It is a file called mypython that contains the following code:

JavaScript

This allows me to specify some environment variables required by Python. Since I install OpenVINO on the remote machine, I would need to add to mypython code the command: source /opt/intel/openvino_2021.1.110/bin/setupvars.sh . However, once I do this, it seems that PyCharm refuses to use my mypython interpreter (it just gets stuck).

Motivation:

  • If I ssh into my remote machine and run source /opt/intel/openvino_2021.1.110/bin/setupvars.sh I can then import cv2 correctly from python3
  • From the PyCharm remote interpreter instead I get the error:
JavaScript

Advertisement

Answer

Possible solution:

  • log into the server using ssh
  • run source /opt/intel/openvino_2021.1.110/bin/setupvars.sh
  • run printenv Include all the variables into the mypython source code. I would still like to know if there is a way to run source /opt/intel/openvino_2021.1.110/bin/setupvars.sh within mypython source code.

EDIT: in my caseremoving this from my environment variables fixed the issue:

JavaScript

Not sure if I had an old OpenCV version compiled with cuda.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement