IBM Quantum Schemas

raw JSON →
0.7.20260419 verified Sat May 09 auth: no python

Pydantic models for IBM Quantum service programs (estimator, sampler, executor, noise-learner). Current version: 0.7.20260419. Released weekly. Requires Python >=3.10.

pip install ibm-quantum-schemas
error ModuleNotFoundError: No module named 'ibm_quantum_schemas'
cause Package not installed or installed in wrong environment.
fix
Run pip install ibm-quantum-schemas in the active environment.
error ImportError: cannot import name 'EstimatorResult' from 'ibm_quantum_schemas'
cause Using old direct import pattern that no longer exists.
fix
Use correct import: from ibm_quantum_schemas.estimator.version_0_1 import EstimatorResult.
error pydantic.ValidationError: ... field required
cause Missing required fields when constructing a model.
fix
Check the model schema for required fields. For example, EstimatorResult requires metadata, values, and precision.
error AttributeError: module 'ibm_quantum_schemas' has no attribute 'executor'
cause Trying to access a version that doesn't exist (e.g., `version_0_1_dev`) after removal.
fix
Use a stable version like version_0_1 or version_0_2.
breaking In version 0.5.20260320, the public interface changed: all imports must now use the pattern `ibm_quantum_schemas.<program>.version_<x_y>.SomeModel`. Old direct imports from `ibm_quantum_schemas` will break.
fix Update imports to include program and version submodule, e.g., `from ibm_quantum_schemas.estimator.version_0_1 import EstimatorResult`.
deprecated The `executor` model version `0.1_dev` removed in favor of `0.2`. The `noise-learner-v3` model versions `0.2_dev` also removed. Avoid using `_dev` versions.
fix Use stable versions like `0.1` or `0.2` without `_dev` suffix.
breaking Models for `noise-learner` changed from `noise-learner-v3` to `noise-learner` in version 0.6.20260414. Old import paths will break.
fix Use `from ibm_quantum_schemas.noise_learner.version_0_1 import ...` instead of `noise_learner_v3`.
gotcha The package requires Python >=3.10. Users on Python 3.9 or earlier will get import errors.
fix Upgrade Python to 3.10 or later.

Create an EstimatorResult model instance and serialize it.

from ibm_quantum_schemas.estimator.version_0_1 import EstimatorResult

result = EstimatorResult(
    metadata=[{"example": "data"}],
    values=[0.5],
    precision=[0.01]
)
print(result.model_dump())