Install & Compatibility
Where this runs
tested against v2024.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 8.1s
py 3.11
✕ build_error
✓ 7.5s
py 3.12
✕ build_error
✓ 7.35s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 11.45s
278MB installed
● package 278MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Core
✓ from openvino.runtime import Core
✗ from openvino.inference_engine import IECore
The `IECore` class was deprecated and removed in OpenVINO 2023.0+, replaced by `openvino.runtime.Core`.
Model
✓ from openvino.runtime import Model
Represents the OpenVINO model graph.
CompiledModel
✓ from openvino.runtime import CompiledModel
Represents a model compiled for a specific device.
convert_model
✓ from openvino import convert_model
✗ from openvino.tools.mo import convert_model
The recommended path for `convert_model` (formerly Model Optimizer) is now directly under `openvino`.
Type
✓ from openvino.runtime import Type
Used for defining tensor data types in programmatic model creation.
opset12
✓ from openvino.runtime import opset12
Provides OpenVINO operations for programmatic model creation (e.g., opset12.parameter, opset12.add).
This quickstart demonstrates how to create an OpenVINO Core object, define a simple model programmatically, compile it for a target device, and perform inference. It uses the `openvino.runtime` API introduced in OpenVINO 2023.0+ and avoids external model files or deep learning frameworks for simplicity.
import openvino as ov
import numpy as np
import os
# 1. Create a Core object
core = ov.Core()
# 2. Define a simple model programmatically (e.g., a single addition operation)
# This avoids external files and frameworks for a minimal example.
input_a = ov.opset12.parameter([1, 3, 224, 224], ov.Type.f32, name="input_a")
input_b = ov.opset12.parameter([1, 3, 224, 224], ov.Type.f32, name="input_b")
result_op = ov.opset12.add(input_a, input_b, name="add_result")
model = ov.Model([result_op], [input_a, input_b], "simple_add_model")
# 3. Compile the model for a specific device (e.g., 'CPU', 'GPU', 'NPU')
# Use 'AUTO' to let OpenVINO select the best available device.
device = os.environ.get("OPENVINO_DEVICE", "CPU") # Default to CPU
try:
compiled_model = core.compile_model(model, device)
print(f"Model compiled successfully for {device} device.")
except RuntimeError as e:
print(f"Warning: Could not compile model for device '{device}': {e}")
print("Falling back to CPU if available.")
device = "CPU"
compiled_model = core.compile_model(model, device)
# 4. Prepare input data
input_data_a = np.random.rand(1, 3, 224, 224).astype(np.float32)
input_data_b = np.random.rand(1, 3, 224, 224).astype(np.float32)
# 5. Perform inference
# Inputs can be passed as a list, dictionary, or single tensor depending on model
outputs = compiled_model([input_data_a, input_data_b])
# 6. Process results
print(f"Inference successful on {device} device.")
# The output is a list of numpy arrays, one for each output of the model
print(f"Output shape: {outputs[0].shape}, dtype: {outputs[0].dtype}")
Debug
Known issues
breakingMajor API changes occurred in OpenVINO 2023.0+ concerning `IECore` to `Core`, `read_network` to `read_model`, and `load_network` to `compile_model`.fixUpdate your code to use `openvino.runtime.Core`, `core.read_model(...)`, and `core.compile_model(...)`. For example, `core = ov.Core()` instead of `core = ov.inference_engine.IECore()`.
affects: 2023.0.0 and later
breakingThe Model Optimizer functionality, previously accessed via `openvino.tools.mo.convert_model`, is now directly exposed as `openvino.convert_model`.fixChange import statements and calls from `from openvino.tools.mo import convert_model` to `from openvino import convert_model`.
affects: 2023.0.0 and later
gotchaDevice selection (e.g., 'CPU', 'GPU', 'NPU') requires the correct drivers and hardware. Using 'AUTO' or a non-existent device may lead to runtime errors or fallback to CPU.fixEnsure the target device is present and drivers are installed. Use `core.available_devices` to list supported devices. For maximum compatibility, use 'CPU' or 'AUTO'.
affects: All versions
Errors
Common errors & fixes
RuntimeError: Cannot find plugin to use for device <device_name>
OpenVINO cannot find the necessary plugin (driver) to run inference on the specified device. This often happens with 'GPU' if Intel graphics drivers or OpenCL/oneAPI runtimes are not installed, or with 'NPU' if the corresponding hardware and drivers are missing.
fixVerify that the target device is physically present and its respective drivers/run-time components are correctly installed. Use `ov.Core().available_devices` to check which devices are recognized by OpenVINO. Fallback to 'CPU' if other devices are unavailable.
AttributeError: 'openvino.runtime.Core' object has no attribute 'read_network'
This error indicates usage of the old API (`read_network` was part of `IECore`) with the new `openvino.runtime.Core` object. The `read_network` method was deprecated and removed.
fixReplace `core.read_network(...)` with `core.read_model(...)`. The new API uses `read_model` to load an IR or other framework model.
RuntimeError: Check 'device != ""' failed at src/inference_engine/ie_core.cpp:...
An empty string was passed as the device name to `core.compile_model()` or `core.get_versions()`, which is not a valid device identifier.
fixAlways provide a valid device string like 'CPU', 'GPU', 'NPU', or 'AUTO'. Ensure any environment variables or configuration values used for the device string are not empty.
Upgrade
Version history
2024.6.0latest on PyPI · released Dec 19, 2024
Audit
Dependencies
No dependency data recorded yet.