pythonraspberry-pi3pythonpathopenvinoraspbian-buster

ModuleNotFoundError: No module named 'openvino'


I'd like to run some official OpenVINO samples, but I always get the following error:

from openvino.inference_engine import IECore
ModuleNotFoundError: No module named 'openvino'

I created a simple script to test this behavior:

IECore_test.py

import sys
from openvino.inference_engine import IECore

ie=IECore()
print("End of test")

I'm testing on Raspberry Pi 3B with Movidius Neural Compute Stick 1 (NCS1).
The OS is Raspberry Pi OS 32-bit (Legacy) Buster (because Bullseye doesn't support NCS1).
OpenVINO Version is l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz,
which is the last version that can support NCS1.

Here's the procedure to set up OpenVINO:

sudo mkdir -p /opt/intel/openvino
mkdir ~/download
cd ~/download
wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2020.3/l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz
sudo tar -xf l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz --strip 1 -C /opt/intel/openvino
echo "source /opt/intel/openvino/bin/setupvars.sh" >> ~/.bashrc
source /opt/intel/openvino/bin/setupvars.sh
sudo usermod -a -G users "$(whoami)"
sh /opt/intel/openvino/install_dependencies/install_NCS_udev_rules.sh

I searched on the Internet, then I noticed that ie_api.so plays an important role.
I found that ie_api.so is located here:

/opt/intel/openvino/python/python3.5/openvino/inference_engine/ie_api.so

I checked $PYTHONPATH:

(openvino_env) pi@raspberrypi:~ $ echo $PYTHONPATH
/opt/intel/openvino/python/python3.7:
/opt/intel/openvino/python/python3:
/opt/intel/openvino/deployment_tools/model_optimizer:

Somehow, /opt/intel/openvino/python/python3.5 was missing.
(And, there is no python3.7 directory under /opt/intel/openvino/python/, but there is one under /usr/lib/.)

So, I ran these two lines:

export PYTHONPATH="/opt/intel/openvino/python/python3.5:$PYTHONPATH"
export PYTHONPATH="/opt/intel/openvino/python/python3.5/openvino/inference_engine:$PYTHONPATH"

Now $PYTHONPATH is:

(openvino_env) pi@raspberrypi:~ $ echo $PYTHONPATH
/opt/intel/openvino/python/python3.5/openvino/inference_engine:
/opt/intel/openvino/python/python3.5:
/opt/intel/openvino/python/python3.7:
/opt/intel/openvino/python/python3:
/opt/intel/openvino/deployment_tools/model_optimizer:

I thought it would work, but python3 IECore_test.py returns another error:

Traceback (most recent call last):
  File "IECore_test.py", line 2, in <module>
    from openvino.inference_engine import IECore
  File "/opt/intel/openvino/python/python3.5/openvino/inference_engine/__init__.py", line 1, in <module>
    from .ie_api import *
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

I can't find libpython3.5m.so.1.0 anywhere.
So, I'm stuck here.
How can I resolve these errors?


Solution

  • Use l_openvino_toolkit_runtime_raspbian_p_2020.3.355.tgz to import IECore on Raspberry Pi.

    enter image description here