title: Custom Python Remove Interpreter with OpenVINO initialization
body: <p>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.</p>
  <p>The remote interpreter that I used is actually &quot;tweaked&quot;. It is a file called <code>mypython</code> that contains the following code:</p>
  <pre><code>#!/bin/bash -l
  export PATH=&quot;/home/ubuntu/.local/bin:/usr/local/cuda-11.1/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:${PATH}&quot;
  export LD_LIBRARY_PATH=&quot;/home/ubuntu/.local/lib:/usr/local/cuda-11.1/lib64:/home/ubuntu/.local/lib:/usr/local/cuda-11.1/lib64:${LD_LIBRARY_PATH}&quot;
  export PYTHONPATH=&quot;/home/ubuntu/VideoProcessingFramework/install/bin:${PYTHONPATH}&quot;
  export PATH=&quot;/home/ubuntu/FFmpeg/build_x64_release_shared/bin:${PATH}&quot;
  export LD_LIBRARY_PATH=&quot;/home/ubuntu/VideoProcessingFramework/install/bin:${LD_LIBRARY_PATH}&quot;
  export LD_LIBRARY_PATH=&quot;/home/ubuntu/FFmpeg/build_x64_release_shared/lib:${LD_LIBRARY_PATH}&quot;
  
  export PATH=&quot;/home/ubuntu/pytorch/build/bin:${PATH}&quot;
  export LD_LIBRARY_PATH=&quot;/home/ubuntu/pytorch/build/lib:${LD_LIBRARY_PATH}&quot;
  
  # My attempt at having OpenVINO working on PyCharm remote interpreter
  export PYTHONPATH=&quot;${PYTHONPATH}:/opt/intel/openvino_2021.1.110/python/python3.6:/opt/intel/openvino_2021.1.110/python/python3:/opt/intel/openvino_2021.1.110/deployment_tools/tools/post_training_optimization_toolkit:/opt/intel/openvino_2021.1.110/deployment_tools/open_model_zoo/tools/accuracy_checker:/opt/intel/openvino_2021.1.110/deployment_tools/model_optimizer:/opt/intel/openvino_2021.1.110/data_processing/dl_streamer/python:/opt/intel/openvino_2021.1.110/data_processing/gstreamer/lib/python3.6/site-packages:/usr/lib/python3/dist-packages&quot;
  export OpenCV_DIR=&quot;/opt/intel/openvino_2021.1.110/opencv/cmake&quot;
  export LD_LIBRARY_PATH=&quot;${LD_LIBRARY_PATH}:/opt/intel/openvino_2021.1.110/data_processing/dl_streamer/lib:/opt/intel/openvino_2021.1.110/data_processing/gstreamer/lib:/opt/intel/openvino_2021.1.110/opencv/lib:/opt/intel/openvino_2021.1.110/deployment_tools/ngraph/lib:/opt/intel/openvino_2021.1.110/deployment_tools/inference_engine/external/hddl_unite/lib:/opt/intel/openvino_2021.1.110/deployment_tools/inference_engine/external/hddl/lib:/opt/intel/openvino_2021.1.110/deployment_tools/inference_engine/external/gna/lib:/opt/intel/openvino_2021.1.110/deployment_tools/inference_engine/external/mkltiny_lnx/lib:/opt/intel/openvino_2021.1.110/deployment_tools/inference_engine/external/tbb/lib:/opt/intel/openvino_2021.1.110/deployment_tools/inference_engine/lib/intel64&quot;
  export GST_SAMPLES_DIR=&quot;/opt/intel/openvino_2021.1.110/data_processing/dl_streamer/samples&quot;
  export MODELS_PATH=&quot;/root/intel/dl_streamer/models&quot;
  export PKG_CONFIG_PATH=&quot;/opt/intel/openvino_2021.1.110/data_processing/dl_streamer/lib/pkgconfig:/opt/intel/openvino_2021.1.110/data_processing/gstreamer/lib/pkgconfig:&quot;
  export GSTREAMER_EXECUTABLES_DIR=&quot;/opt/intel/openvino_2021.1.110/data_processing/gstreamer/bin:/opt/intel/openvino_2021.1.110/data_processing/gstreamer/bin/gstreamer-1.0&quot;
  export GST_PLUGIN_PATH=&quot;$GST_PLUGIN_PATH:/opt/intel/openvino_2021.1.110/data_processing/gstreamer/lib/gstreamer-1.0&quot;
  export GST_PLUGIN_SCANNER=&quot;/opt/intel/openvino_2021.1.110/data_processing/gstreamer/bin/gstreamer-1.0/gst-plugin-scanner&quot;
  export GST_VAAPI_ALL_DRIVERS=1
  
  
  /usr/bin/python3 &quot;$@&quot;
  
  </code></pre>
  <p>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 <code>mypython</code> code the command: <code>source /opt/intel/openvino_2021.1.110/bin/setupvars.sh  </code>. However, once I do this, it seems that PyCharm refuses to use my <code>mypython</code> interpreter (it just gets stuck).</p>
  <p>Motivation:</p>
  <ul>
  <li>If I ssh into my remote machine and run <code>source /opt/intel/openvino_2021.1.110/bin/setupvars.sh</code> I can then import cv2 correctly from python3</li>
  <li>From the PyCharm remote interpreter instead I get the error:</li>
  </ul>
  <pre><code>Traceback (most recent call last):
    File &quot;/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py&quot;, line 2882, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File &quot;&lt;ipython-input-2-c8ec22b3e787&gt;&quot;, line 1, in &lt;module&gt;
      import cv2
  ImportError: /opt/intel/openvino_2021.1.110/opencv/lib/libopencv_dnn.so.4.5: undefined symbol: _ZN15InferenceEngine10CNNNetworkC1ERKSt10shared_ptrIN6ngraph8FunctionEE
  
  </code></pre>