Open drimyus opened 5 months ago
Could you please try:
python3 -c "import openvino; print(openvino.__version__)"
Could you please make sure your PYTHONPATH
environment variable doesn't point to anything that could be OpenVINO related? Which version of pip
are you using?
openvino version is 2024.0.0
pip3 list| grep openvino
openvino 2024.0.0
openvino-dev 2024.0.0
openvino-telemetry 2023.2.1
pip3 version 24.0
pip3 --version
pip 24.0 from /{venv_path}/lib/python3.10/site-packages/pip (python 3.10)
Could you please try:
python3 -c "import openvino; print(openvino.__version__)"
python3 -c "import openvino; print(openvino.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'openvino' has no attribute '__version__'
But I can see openvino in pip3 list
.
Could you please reinstall openvino
?
Looks like /{venv_path}/lib/python3.10/site-packages/openvino
does not contain any file (or does not contain __init__.py
at least)
@ilya-lavrenov when I checked the openvino folder in venv, I can get this list like below
$ ls venv/lib/python3.10/site-packages/openvino
frontend __init__.py model_zoo preprocess __pycache__ runtime torch
helpers libs _offline_transformations properties _pyopenvino.cpython-310-x86_64-linux-gnu.so tools utils.py
Have you installed libpython3.10
?
Yes, I have installed python3.10
$ sudo apt install libpython3.10
[sudo] password for tk:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libpython3.10 is already the newest version (3.10.12-1~22.04.3).
libpython3.10 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
Let me update the Issue description
First I installed openvino==2024.0.0 in empty venv, it worked fine But when I tried to install (model_zoo api package)[https://github.com/openvinotoolkit/open_model_zoo/blob/master/demos/common/python/model_zoo/model_api/README.md#installing-python-model-api-package] in same venv, the issue occurred
ImportError: cannot import name 'Core' from 'openvino'
I can't reproduce the issue:
python3 -m venv venv
source ./venv/bin/activate
python -m pip install -U pip
python -m pip install openvino==2024.0.0
python -m pip install demos/common/python
python -c "from openvino import Core; print(Core().available_devices)"
I tried both 2024.0.0 (https://github.com/openvinotoolkit/open_model_zoo/commit/37f60eb7fe1dcdedc552b2fb184d646723ed5e80) and master (https://github.com/openvinotoolkit/open_model_zoo/commit/9c6d95a2a668d6ae41aebda42b15608db7dd3fa0).
I was getting the same ImportError on Windows 11 Enterprise, but installing the VC++ runtime components (specifically, vc_redist.x64.exe) fixed the problem. Is there an equivalent module of runtime components for Linux?
Before installing vc_redist.x64:
C:\Users\sdp>python --version
Python 3.11.9
C:\Users\sdp>python -m venv openvino_env
C:\Users\sdp>openvino_env\Scripts\activate
(openvino_env) C:\Users\sdp>python -m pip install --upgrade pip
...
(openvino_env) C:\Users\sdp>pip install openvino==2024.1.0
...
(openvino_env) C:\Users\sdp>python -c "from openvino import Core; print(Core().available_devices)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'Core' from 'openvino' (C:\Users\sdp\openvino_env\Lib\site-packages\openvino\__init__.py)
After installing vc_redist.x64:
(openvino_env) C:\Users\sdp>python -c "from openvino import Core; print(Core().available_devices)"
['CPU', 'NPU']
(openvino_env) C:\Users\sdp>python -c "import openvino; print(openvino.__version__)"
2024.1.0-15008-f4afc983258-releases/2024/1
@jiwaszki, It seems Python OpenVINO depends on Visual Studio being installed (2019 or just https://www.microsoft.com/en-in/download/details.aspx?id=48145). I don't really know how to verify that so we could describe it in the docs. Maybe you have some ideas.
@jiwaszki, It seems Python OpenVINO depends on Visual Studio being installed (2019 or just https://www.microsoft.com/en-in/download/details.aspx?id=48145). I don't really know how to verify that so we could describe it in the docs. Maybe you have some ideas.
It depends on MSVC runtime (vs_redist). It's highlighted in PyPi OpenVINO page:
This issue was originally reported on Linux, where OpenVINO requires the GNU development tools. Installing GCC 7.5 may fix this problem on Linux.
Do you use Python 3.8?
If yes, you also need to install libpython3.8
(which seems to be transitively installed by gcc 7.5 as well)
I'm using Python 3.11 on Windows 11 Enterprise. This issue was originally reported for Python 3.10 on Linux. However, the underlying cause appears similar.
OpenVINO Version
2024.0.0
Operating System
Other (Please specify in description)
Device used for inference
CPU
Framework
None
Model used
No response
Issue description
ImportError: cannot import name 'Core' from 'openvino'
OS: ubuntu 22.04 openvino: 2024.0.0 installed using pypi
pip3 install openvino~=2024.0.0
python: python3.10I followed instruction document to install openvino(2024.0.0), but failed to import sub modules.
Step-by-step reproduction
No response
Relevant log output
Issue submission checklist