Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6478 Discussions

Ubuntu 22.04 and 24.04 python3-openvino packages and thereby APT installation broken

JohannesQ
Employee
1,984 Views

Since openvino 2024.1, the python3-openvino-2024.x packages from the APT repositories do not work and the hello_query_device.py only returns an "ModuleNotFoundError: No module named 'openvino._pyopenvino' " error.

This seems to be caused by a pyopenvino .so dynamically library packaged and installed that is built for python 3.8 whereas the versions used with Ubunutu 22.04 or 24.04 are python 3.10 and 3.12 respectively.

13 Replies
Iffa_Intel
Moderator
1,873 Views

Hi,


could you share:

  1. The steps & commands that you did till the point of error?.
  2. Your references (if available) for clarification purposes.



Cordially,

Iffa


0 Kudos
JohannesQ
Employee
1,851 Views

Hi,

I exactly followed the step described on Install Intel® Distribution of OpenVINO™ Toolkit for Linux Using APT Repository — OpenVINO™ documentation.

When running 

python3 /usr/share/openvino/samples/python/hello_query_device/hello_query_device.py

after the installation, I receive the following:

$ python3 /usr/share/openvino/samples/python/hello_query_device/hello_query_device.py
Traceback (most recent call last):
File "/usr/share/openvino/samples/python/hello_query_device/hello_query_device.py", line 8, in <module>
import openvino as ov
File "/usr/lib/python3/dist-packages/openvino/__init__.py", line 21, in <module>
from openvino import runtime as runtime
File "/usr/lib/python3/dist-packages/openvino/runtime/__init__.py", line 8, in <module>
from openvino._pyopenvino import get_version
ModuleNotFoundError: No module named 'openvino._pyopenvino'

whereas  when installing version 2024.0 the output is:

$ python3 /usr/share/openvino/samples/python/hello_query_device/hello_query_device.py
[ INFO ] Available devices:
[ INFO ] CPU :
[ INFO ] SUPPORTED_PROPERTIES:
[ INFO ] AVAILABLE_DEVICES:
[ INFO ] RANGE_FOR_ASYNC_INFER_REQUESTS: 1, 1, 1
[ INFO ] RANGE_FOR_STREAMS: 1, 12
[ INFO ] EXECUTION_DEVICES: CPU
[ INFO ] FULL_DEVICE_NAME: 13th Gen Intel(R) Core(TM) i5-1345URE
...

 

It looks like the python3-openvino deb packages contain the module for a wrong python version (the machine used has Ubuntu 22.04 with python 3.10).

Working openvino 2024.0 installation:

$ dpkg -L python3-openvino-2024.0.0 
...
/usr/lib/python3/dist-packages/openvino
/usr/lib/python3/dist-packages/openvino-2024.0.0-py3.10.egg-info
/usr/lib/python3/dist-packages/openvino-2024.0.0-py3.10.egg-info/PKG-INFO
/usr/lib/python3/dist-packages/openvino-2024.0.0-py3.10.egg-info/SOURCES.txt
/usr/lib/python3/dist-packages/openvino-2024.0.0-py3.10.egg-info/dependency_links.txt
/usr/lib/python3/dist-packages/openvino-2024.0.0-py3.10.egg-info/entry_points.txt
/usr/lib/python3/dist-packages/openvino-2024.0.0-py3.10.egg-info/not-zip-safe
/usr/lib/python3/dist-packages/openvino-2024.0.0-py3.10.egg-info/requires.txt
/usr/lib/python3/dist-packages/openvino-2024.0.0-py3.10.egg-info/top_level.txt
/usr/lib/python3/dist-packages/openvino/__init__.py
/usr/lib/python3/dist-packages/openvino/_offline_transformations
/usr/lib/python3/dist-packages/openvino/_offline_transformations/__init__.py
/usr/lib/python3/dist-packages/openvino/_pyopenvino.cpython-310-x86_64-linux-gnu.so
...

VERSUS broken openvino-2024.2 installation:

$ dpkg -L python3-openvino-2024.2.0 
...
/usr/lib/python3/dist-packages/openvino
/usr/lib/python3/dist-packages/openvino-2024.2.0-py3.8.egg-info
/usr/lib/python3/dist-packages/openvino-2024.2.0-py3.8.egg-info/PKG-INFO
/usr/lib/python3/dist-packages/openvino-2024.2.0-py3.8.egg-info/SOURCES.txt
/usr/lib/python3/dist-packages/openvino-2024.2.0-py3.8.egg-info/dependency_links.txt
/usr/lib/python3/dist-packages/openvino-2024.2.0-py3.8.egg-info/entry_points.txt
/usr/lib/python3/dist-packages/openvino-2024.2.0-py3.8.egg-info/not-zip-safe
/usr/lib/python3/dist-packages/openvino-2024.2.0-py3.8.egg-info/requires.txt
/usr/lib/python3/dist-packages/openvino-2024.2.0-py3.8.egg-info/top_level.txt
/usr/lib/python3/dist-packages/openvino/__init__.py
/usr/lib/python3/dist-packages/openvino/_offline_transformations
/usr/lib/python3/dist-packages/openvino/_offline_transformations/__init__.py
/usr/lib/python3/dist-packages/openvino/_pyopenvino.cpython-38-x86_64-linux-gnu.so
...

See the py3.10.egg vs py3.8.egg  and cpython-310 vs cpython-38 in the packaged python files.

0 Kudos
Iffa_Intel
Moderator
1,772 Views

Hi,

 

what I noticed is, you need to carefully choose the correct repo in this section

Iffa_Intel_0-1721662578289.png

 

I managed to install and use OV without issue if I do so:

Build is successful

1_ub20.JPG

Query device script can be run.

2_ub20.JPG

 

 

Else, if you added the wrong repo, the build will crash halfway and the query device script will fail:

Crashed at 62% & the terminal automatically closed

1_22ub.JPG

Query device script fail with the same error as yours.

2_22ub.JPG

 

Please ensure you choose and add the correct repo according to Ubuntu version.

 

Cordially,

Iffa

 

0 Kudos
JohannesQ
Employee
1,738 Views

Hi Iffa,

 

I'm using the correct repos:

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

$ cat /etc/apt/sources.list.d/intel-openvino-2024.list
deb https://apt.repos.intel.com/openvino/2024 ubuntu22 main

 and

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

$ cat /etc/apt/sources.list.d/intel-openvino-2024.list
deb https://apt.repos.intel.com/openvino/2024 ubuntu24 main

Several colleagues are facing the same issues, the OpenVINO 2024.1 and 2024.2 Python bindings deb packages from the Ubuntu 22 and 24 apt repositories are broken or the wrong ones (matching and built for Ubuntu 20).

  

Iffa_Intel
Moderator
1,705 Views

We'll further investigate this and get back to you.



Cordially,

Iffa


0 Kudos
Matthias1102
Employee
1,659 Views

I can confirm Johannes' observations.

I have fresh Ubuntu 22.04 LTS installation and I think that I have the appropriate sources for OpenVINO 2024.2:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy

$ cat /etc/apt/sources.list.d/intel-openvino-2024.list
deb [signed-by=/usr/share/keyrings/openvino-archive-keyring.gpg] https://apt.repos.intel.com/openvino/2024 ubuntu22 main

When I run the Hello Query Device Python sample application, it fails, because I have Python 3.10, whereas OpenVINO is installed with libraries for Python 3.8:

$ python3 /usr/share/openvino/samples/python/hello_query_device/hello_query_device.py
Traceback (most recent call last):
File "/usr/share/openvino/samples/python/hello_query_device/hello_query_device.py", line 8, in <module>
import openvino as ov
File "/usr/lib/python3/dist-packages/openvino/__init__.py", line 21, in <module>
from openvino import runtime as runtime
File "/usr/lib/python3/dist-packages/openvino/runtime/__init__.py", line 8, in <module>
from openvino._pyopenvino import get_version
ModuleNotFoundError: No module named 'openvino._pyopenvino'

$ sudo find / -name "*_pyopenvino*"
/usr/lib/python3/dist-packages/openvino/_pyopenvino.cpython-38-x86_64-linux-gnu.so

$ python3 --version
Python 3.10.12

A colleague of mine has reported that the issue does not occur if he creates a Python venv before he installs OpenVINO. If he uses a Python venv, he receives the libraries for Python 3.10.

Could it be possible that the OpenVINO installer has an issue with identifying the correct Python version if a native environment is used?

0 Kudos
wb666greene
Beginner
1,593 Views

How does using a python virtual environment effect an apt install?

I have both Conda and VENV virtual environments on my system already before I did the apt install.

 

I'm having the exact problem with the apt install on Ubuntu 22.04

I have this: /usr/lib/python3/dist-packages/openvino/_pyopenvino.cpython-38-x86_64-linux-gnu.so and python 3.10.12 same as you.

This is what apt installed


apt list --installed | grep openvino

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libopenvino-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-auto-batch-plugin-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-auto-plugin-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-dev-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-hetero-plugin-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-intel-cpu-plugin-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-intel-gpu-plugin-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-intel-npu-plugin-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-ir-frontend-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-onnx-frontend-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-paddle-frontend-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-pytorch-frontend-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-tensorflow-frontend-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
libopenvino-tensorflow-lite-frontend-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed,automatic]
openvino-2024.2.0/ubuntu22,now 2024.2.0.15519 all [installed]
openvino-libraries-2024.2.0/ubuntu22,now 2024.2.0.15519 all [installed,automatic]
openvino-libraries-dev-2024.2.0/ubuntu22,now 2024.2.0.15519 all [installed,automatic]
openvino-samples-2024.2.0/ubuntu22,now 2024.2.0.15519 all [installed,automatic]
openvino-samples-python-2024.2.0/ubuntu22,now 2024.2.0.15519 all [installed]
python3-openvino-2024.2.0/ubuntu22,now 2024.2.0.15519 amd64 [installed]


So how do we fix this? 

I'm trying to avoid a virtual environment here to simplify the installation instructions.

 

I was ready to kick OpenVINO to the curb after I got Darknet YOLO4 running on the GPU and NCS2, as they have never cared one bit about breaking existing code with new versions, but I found a tutorial on running Ultralytics YOLO8 on the GPU with 2024.0 and it seems to work very well, but I need to figure out how to get MobilenetSSD_v2 running on OpenVINO 2024.2 and can't get to first base, since the opencv-openvino is no longer part of openvino so the: 

cv2.dnn.readNet("mobilenet_ssd_v2/MobilenetSSDv2cocoIR10.xml", "mobilenet_ssd_v2/MobilenetSSDv2cocoIR10.bin")

function is no longer there. 

 

An 8th gen or newer i3 with integrated graphics easily supports four 4K cameras with initial CPU mobilenetSSD_v2 detection followed by a digital zoom and darknet YOLO4 verification.  Laptops like this or better can be picked up on the used market for little more than the price of a RaspberryPi4 and the extras it needs to work, making a very cost effective addon to a commercial DVR security system like from Lorex or Amcrest.

 

My project is here: https://github.com/wb666greene/AI-Person-Detector-with-YOLO-Verification/blob/main/README.md 

 

0 Kudos
JohannesQ
Employee
1,463 Views

Still the same issue in 2024.3 ...


0 Kudos
Iffa_Intel
Moderator
1,213 Views

Hi,


From our side, we are unable to see the same issue as yours even after furthering investigation.

Please help to check your Python versions (Ubuntu 20.04 = Python 3.8, Ubuntu 22.04 =Python 3.10).



Cordially,

Iffa




0 Kudos
JohannesQ
Employee
1,164 Views

Hi,

I can't understand how you are not able to reproduce the problem.

 

I've attached a Dockerfile (remove the txt extension) to easily and quickly reproduce the different install configurations by selecting Ubuntu and OpenVINO version combinations.

The build will fail with the python error message cited above.

# docker build --progress plain .
# FAILS (default args are Ubuntu 22.04 and OpenVINO 2024.3.0)

# Working combinations:
# Ubuntu 20.04 and all OpenVINO 2024.x versions -> docker build --progress plain --build-arg UBUNTU_YEAR=20 --build-arg OPENVINO_VERSION=<DESIRED_VER>
# Ubuntu 22.04 and OpenVINO 2024.0.0 -> docker build --progress plain --build-arg UBUNTU_YEAR=22 --build-arg OPENVINO_VERSION=2024.0.0

# Failing:
# Ubuntu 22.04 and OpenVINO 2024.1.0 or newer -> docker build --progress plain --build-arg UBUNTU_YEAR=22 --build-arg OPENVINO_VERSION=2024.[1|2|3].0
# Ubuntu 24.04 and OpenVINO 2024.1.0 or newer -> docker build --progress plain --build-arg UBUNTU_YEAR=24 --build-arg OPENVINO_VERSION=2024.[1|2|3].0

 

Regards,

Johannes

0 Kudos
Iffa_Intel
Moderator
1,097 Views

Hi,

 

If you are actually trying to build a custom OpenVINO Docker image on Ubuntu, this is the official way to do it.

 

For easier options, you can use the pre-built image.

 

You may refer here for more info.

 

Cordially,

Iffa

0 Kudos
Iffa_Intel
Moderator
927 Views

Hi,


Intel will no longer monitor this thread since we have provided a solution. If you need any additional information from Intel, please submit a new question. 



Cordially,

Iffa


0 Kudos
JohannesQ
Employee
833 Views

Issue has been filed on Github and was acknowledged there.
Check the progress there: [Bug]: Ubuntu 22.04 and 24.04 python3-openvino packages and thereby APT installation broken #26061 

0 Kudos
Reply