Install & Compatibility
Where this runs
tested against v0.3.10 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.896s · 102.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 5.0s · import 0.884s · 99MB
104MB installed
● package 104MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Program
✓ from oqpy import Program
✗ from oqpy.program import Program
Program is exported at the top-level oqpy package.
Measurement
✓ from oqpy import Measurement
No common mistake.
Create a simple OpenQASM 3 program with two qubits, apply Hadamard, and measure.
from oqpy import Program
# Create a quantum program
program = Program()
# Declare a qubit register
q = program.declare_qubit('q', size=2)
# Add a gate
program.gate("h", q[0])
# Measure
program.measure(q[0], program.declare_bit('c'))
# Output OpenQASM 3
print(program.to_qasm())
Errors
Common errors & fixes
AttributeError: module 'oqpy' has no attribute 'Program'
Incorrect import: many examples online use `from oqpy.program import Program` but the correct import is `from oqpy import Program`.
fixUse `from oqpy import Program`.
TypeError: extern() missing 1 required positional argument: 'return_type'
In oqpy 0.3.5+, `extern()` requires a `return_type` argument.
fixAdd `return_type` to extern declaration, e.g., `program.extern('my_extern', return_type=oqpy.FloatVar)`. ValueError: Cannot convert value 0 to an OQPY duration
Using plain integers/float where a duration type is expected.
fixWrap the value in `DurationLiteral`, e.g., `oqpy.DurationLiteral(0, 'ns')`.
Upgrade
Version history
0.3.10latest on PyPI · released Feb 25, 2026
Audit
Dependencies
No dependency data recorded yet.