Registry / serialization / pyqir
library0.12.5pypypi✓ verified 88d ago

A Python library for generating, parsing, and evaluating Quantum Intermediate Representation (QIR). Current version is 0.12.4, with irregular release cadence, typically 3-4 minor releases per year.

pip install pyqir
INSTALL
IMPORT
SIG · PYQIR
P
pyqir
serializationpythonv0.12.5
Install
1.6s avg
Import
14ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.6.2 · 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
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.014s · 25MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Builder
✓ from pyqir import Builder
BasicBlock
✓ from pyqir import BasicBlock
Context
✓ from pyqir import Context
Module
✓ from pyqir import Module
Qubit
✓ from pyqir import Qubit
__version__
✓ from pyqir import __version__
✗ import pyqir; pyqir.__version__
Also valid, but direct import is clearer.
evaluate
✓ from pyqir.evaluator import evaluate
✗ from pyqir import evaluate
evaluate is a submodule.
SimpleEvaluator
✓ from pyqir.evaluator import SimpleEvaluator
✗ from pyqir import SimpleEvaluator
SimpleEvaluator is in evaluator submodule.
__qir__
✓ from pyqir import __qir__
Provides access to QIR constants.

Create a simple QIR module with a Hadamard and measurement, then evaluate it.

from pyqir import Builder, BasicBlock, Context, Module, Qubit from pyqir.evaluator import evaluate context = Context() module = Module(context) builder = Builder(context) entry = BasicBlock(context, "entry", module) builder.insert_at_end(entry) qubit = builder.add_qubit() builder.h(qubit) builder.mz(qubit) result = evaluate(module, {}) print(result)
Debug
Known issues
breakingPyQIR 0.12.0 switched to QIR 2.0 with opaque pointer support, breaking modules generated with older versions. Upgrade your QIR generation code.
fix
Use the latest API. See upgrade guide: https://github.com/qir-alliance/pyqir/blob/main/docs/upgrade.md#pyqir-012
affects: >=0.12.0
deprecatedThe `evaluate` function and `SimpleEvaluator` may be deprecated in future versions. Prefer newer evaluation APIs if available.
fix
Monitor docs for replacement APIs.
affects: <0.13?
gotchaQubit IDs are not automatically reset; calling `add_qubit()` increments an internal counter. When reusing a builder, qubit indices can become stale.
fix
Keep a local reference to qubits or reset the builder context if needed.
affects: all
gotchaThe library is compiled with Rust/PyO3; ensure your Python version is >=3.9. Pre-built wheels may not be available for all platforms (e.g., ARM Linux).
fix
Upgrade Python to 3.9+ or use maturin to build from source.
affects: all
Errors
Common errors & fixes
AttributeError: module 'pyqir' has no attribute 'evaluate'
Trying to import evaluate directly from pyqir instead of pyqir.evaluator.
fix
Replace 'from pyqir import evaluate' with 'from pyqir.evaluator import evaluate'
ImportError: cannot import name 'SimpleEvaluator' from 'pyqir'
SimpleEvaluator is in a submodule, not directly in pyqir.
fix
Replace 'from pyqir import SimpleEvaluator' with 'from pyqir.evaluator import SimpleEvaluator'
RuntimeError: Unable to find a prebuilt wheel for pyqir on this platform
No prebuilt wheel for your platform (e.g., ARM Linux, Python 3.8).
fix
Upgrade to Python >=3.9 or build from source using maturin.
AttributeError: 'NoneType' object has no attribute 'context'
Builder or BasicBlock was used before being properly initialized.
fix
Ensure you create a Context first and pass it to all objects.
Upgrade
Version history
0.12.5latest on PyPI · released May 12, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Resources
pyqir — pip install pyqir · libregistry