Registry / ai-ml / pyquil

pyquil

JSON →
library4.17.0pypypi✓ verified 88d ago

PyQuil is a Python library for creating and running Quantum Instruction Language (Quil) programs on Rigetti quantum processors and simulators. The current version is 4.17.0, supporting Python 3.9-3.12. It sees regular releases alongside Rigetti's Forest SDK.

pip install pyquil
INSTALL
IMPORT
SIG · PYQUIL
P
pyquil
ai-mlpythonv4.17.0
Install
15.1s avg
Import
1843ms
Disk
318MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
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
musl
py 3.10–3.95 runs
build_error
glibc
py 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'))
Debug
Known issues
breakingPyQuil 4.x introduced breaking changes from 3.x: import paths changed (e.g., `from pyquil.api` instead of `from pyquil.quilbase`), and the `QuantumComputer.run()` now expects compiled executables, not programs.
fix
Update import statements and use `qc.compile(program)` before running.
affects: >=4.0.0
deprecatedThe `from pyquil.quil` module and `from pyquil.parser` are deprecated in 4.x. Use `from pyquil import Program` and `from pyquil.gates` for gate definitions.
fix
Switch to the new import paths; see migration guide.
affects: >=4.0.0 <5.0.0
gotchaWhen using `get_qc('2q-qvm')`, the QVM (quantum virtual machine) is a simulator that requires the QVM server to be running locally or via Forest SDK. Without it, calls to `run` will hang or fail with connection errors.
fix
Ensure the QVM server is running: `qvm -S` in a separate terminal, or use a remote QPU endpoint.
affects: All
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.
fix
Use `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.
fix
Replace `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.
fix
Set 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.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
pyquil — pip install pyquil · libregistry