ModuleNotFoundError: No module named ‘openvino’

huangapple go评论62阅读模式
英文:

ModuleNotFoundError: No module named 'openvino'

问题

我想运行一些官方的OpenVINO示例,但我总是遇到以下错误:

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

我创建了一个简单的脚本来测试这个行为:

IECore_test.py

import sys
from openvino.inference_engine import IECore

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

我在Raspberry Pi 3B上进行测试,使用Movidius Neural Compute Stick 1(NCS1)。操作系统是Raspberry Pi OS 32位(Legacy)Buster(因为Bullseye不支持NCS1)。OpenVINO版本是l_openvino_toolkit_runtime_raspbian_p_2020.3.194.tgz,这是最后一个支持NCS1的版本。

以下是设置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

我在互联网上搜索后发现ie_api.so起到了重要作用。我发现ie_api.so位于以下位置:

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

我检查了$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:

一些原因,/opt/intel/openvino/python/python3.5 被漏掉了。(而且,在/opt/intel/openvino/python/下没有python3.7目录,但在/usr/lib/下有一个。)

因此,我运行了以下两行:

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

现在$PYTHONPATH如下:

(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:

我认为它应该可以工作,但python3 IECore_test.py 返回另一个错误:

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

我找不到libpython3.5m.so.1.0文件的位置。所以,我被困在这里。如何解决这些错误?

英文:

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 &#39;openvino&#39;

I created a simple script to test this behavior:

IECore_test.py

import sys
from openvino.inference_engine import IECore

ie=IECore()
print(&quot;End of test&quot;)

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 &quot;source /opt/intel/openvino/bin/setupvars.sh&quot; &gt;&gt; ~/.bashrc
source /opt/intel/openvino/bin/setupvars.sh
sudo usermod -a -G users &quot;$(whoami)&quot;
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=&quot;/opt/intel/openvino/python/python3.5:$PYTHONPATH&quot;
export PYTHONPATH=&quot;/opt/intel/openvino/python/python3.5/openvino/inference_engine:$PYTHONPATH&quot;

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 &quot;IECore_test.py&quot;, line 2, in &lt;module&gt;
    from openvino.inference_engine import IECore
  File &quot;/opt/intel/openvino/python/python3.5/openvino/inference_engine/__init__.py&quot;, line 1, in &lt;module&gt;
    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?

答案1

得分: 1

使用l_openvino_toolkit_runtime_raspbian_p_2020.3.355.tgz在树莓派上导入IECore

ModuleNotFoundError: No module named ‘openvino’

英文:

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

ModuleNotFoundError: No module named ‘openvino’

huangapple
  • 本文由 发表于 2023年2月24日 00:53:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75547914.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定