Install & Compatibility
Where this runs
tested against v4.17.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
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 15.1s · import 1.474s · 310MB
318MB installed
● package 318MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Program
✓ from pyquil import Program
get_qc
✓ from pyquil import get_qc
✗ from pyquil.api import get_qc
In v4.x, get_qc is a top-level import; the submodule path changed.
AbstractCompiler
✓ from pyquil.api import AbstractCompiler
✗ from pyquil.compiler import AbstractCompiler
Common mistake due to old docs; correct module is pyquil.api.
Minimal example creating a Bell state circuit and running on the QVM simulator.
from pyquil import Program, get_qc
from pyquil.gates import H, CNOT, MEASURE
# Create a Bell state program
p = Program()
p += H(0)
p += CNOT(0, 1)
ro = p.declare('ro', 'BIT', 2)
p += MEASURE(0, ro[0])
p += MEASURE(1, ro[1])
# Get a quantum computer (simulator)
qc = get_qc('2q-qvm')
# Run the program
executable = qc.compile(p)
result = qc.run(executable)
print(result.readout.get('ro'))
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyquil.api'
Incorrect import path: users try `from pyquil.api import ...` but the module is not installed or deprecated in older versions.
fixUse `from pyquil import get_qc` for the quantum computer object; API classes are under `pyquil.api` but may require separate import.
AttributeError: 'Program' object has no attribute 'run'
In PyQuil 4.x, programs are not directly runnable; they must be compiled first.
fixReplace `program.run(qc)` with `qc.compile(program)` then `qc.run(executable)`.
TypeError: 'QuantumComputer.run()' got an unexpected keyword argument 'shots'
In PyQuil 4.x, the `run()` method no longer accepts `shots`; the number of shots is set in the program via `measurements` or in the `compile` step.
fixSet shots via `program.wrap_in_numshots_loop(N)` before compiling.
Upgrade
Version history
4.17.0latest on PyPI · released Oct 8, 2025
Audit
Dependencies
No dependency data recorded yet.