← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe
Rigetti Computing
pyQuil and Quil starter package
Official source: rigetti/pyquil
Download ZIP (free)pyQuil, the Python library for Rigetti's Quil instruction set: a tested example that generates a Bell program as Quil, and a guide to running it with the local QVM.
What is pyQuil?
pyQuil is the Python library for writing programs in Quil, Rigetti's quantum instruction set. Quil is a low-level language that defines classical and quantum operations in the same program.
When to use it
- When you want to work on Rigetti's superconducting processors.
- When you want to see a quantum program at the instruction level, very close to the hardware.
The example in this package
quil_programi.py builds the Bell program and prints its Quil text. Since
compiling and running the program needs two separate servers, the example only
builds the program.
Running the program
Start Rigetti's quilc (compiler) and qvm (simulator) servers with Docker:
docker run --rm -it -p 5555:5555 rigetti/quilc -R
docker run --rm -it -p 5000:5000 rigetti/qvm -S
Then in Python:
from pyquil import get_qc
qc = get_qc("2q-qvm")
result = qc.run(qc.compile(p))
print(result.get_register_map()["ro"])
Installation and running
pip install pyquil
python quil_programi.py
Tested with: pyquil 4.22.0, Python 3.12.
Official source
- Repository: rigetti/pyquil
- Latest release: v4.22.0 — 8 October 2026
- Licence: Apache-2.0
- Stars: 1,501
- Default branch commit when the catalogue was built:
0c48f7be59ce(9 October 2026)
Links
Package contents
quil_programi.pyREADME.en.md— this fileREADME.md— the same guide in TurkishLICENSE— the licence of the files in this packageKAYNAK.json— a machine-readable summary of the official sourceUPSTREAM-LICENSE.txt— the licence text of the official project
Licence
The example code and the guide in this package were written by the Quantum Store editors and are MIT licensed. The project it uses is subject to its own licence (Apache-2.0).
Quantum Store — https://hakanerdogan.com/en
Example code
The example shipped in the package, run and checked. Comments and printed messages are in Turkish; the code is the same in any language. Everything is in the ZIP.
quil_programi.py
"""pyQuil ile Quil programı yaz.
Bu örnek programı oluşturur ve Quil metnini yazdırır. Çalıştırmak için
Rigetti'nin quilc derleyicisi ve qvm simülatörü gerekir (README'ye bakın).
Çalıştırma:
pip install pyquil
python quil_programi.py
"""
from pyquil import Program
from pyquil.gates import CNOT, H, MEASURE
p = Program()
ro = p.declare("ro", "BIT", 2)
p += H(0)
p += CNOT(0, 1)
p += MEASURE(0, ro[0])
p += MEASURE(1, ro[1])
p.wrap_in_numshots_loop(1000)
quil = p.out()
print(quil)
assert "CNOT 0 1" in quil and "MEASURE 1 ro[1]" in quil
print("Tamam: Quil programı oluşturuldu.")