Registry / ai-ml / cirq-core

cirq-core

JSON →
library1.7.0pypypi✓ verified 24d ago

Cirq is a Python framework developed by Google's Quantum AI team for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits. It focuses on providing fine-tuned control over quantum circuits and gate-level operations for current-generation quantum processors. The library is actively maintained, with frequent releases, and is currently at version 1.6.1.

pip install cirq
INSTALL
IMPORT
SIG · CIRQ-CORE
C
cirq-core
ai-mlpythonv1.7.0
Install
23.8s avg
Import
5918ms
Disk
604MB
Pass rate
6/ 10
Env Coverage6 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.5.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
glibc
py 3.10
1/2 runs
✓ 27.15s
py 3.11
1/2 runs
✓ 24.8s
py 3.12
1/2 runs
✓ 26s
py 3.13
1/2 runs
✓ 25.4s
py 3.9
✓ 0.05s
✓ 39.4s
604MB installed
● package 604MB
Code
Verified usage

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

cirq
import cirq
The main top-level package for all core functionalities.
LineQubit
import cirq # ... q0, q1 = cirq.LineQubit.range(2)
from cirq.devices import LineQubit
Many common classes and functions are exposed directly under the `cirq` namespace for convenience, avoiding deeper module imports.
Simulator
import cirq # ... simulator = cirq.Simulator()
from cirq.simulators import Simulator
Simulators are often accessed directly via `cirq.Simulator`.

This quickstart demonstrates how to build a basic quantum circuit, simulate it using Cirq's built-in simulator, and retrieve measurement results as a histogram. It creates a Bell state using Hadamard and CNOT gates and then measures both qubits.

import cirq import numpy as np # Create two qubits q0, q1 = cirq.LineQubit.range(2) # Build a simple Bell state circuit circuit = cirq.Circuit( cirq.H(q0), cirq.CNOT(q0, q1), cirq.measure(q0, q1, key='result') ) print("Circuit:") print(circuit) # Simulate the circuit 1000 times simulator = cirq.Simulator() result = simulator.run(circuit, repetitions=1000) # Display the measurement results print("\nMeasurement results (histogram):") print(result.histogram(key='result'))
cirq --version
Debug
Known issues
breakingThe minimum required Python version has been increased to 3.11.0. Older Python versions are no longer supported.
fix
Upgrade your Python environment to 3.11.0 or later. Consider using a virtual environment (e.g., `python -m venv .venv`).
affects: >=1.6.0
breakingThe `cirq-rigetti` subpackage has been completely removed from the main `cirq` distribution. It was previously deprecated in v1.5.0.
fix
For legacy code requiring `cirq-rigetti` functionality, use the last standalone release `cirq-rigetti-1.5.0`. Alternatively, migrate to other supported hardware integrations or the standalone `pyquil` library.
affects: >=1.6.0
breakingThe `cirq-ft` package (for fault-tolerant resource estimation) was removed from Cirq. It was deprecated in v1.3.0.
fix
The functionality of `cirq-ft` has been moved to the `Qualtran` repository. Users should now use the `Qualtran` library for fault-tolerant resource estimation needs.
affects: >=1.4.0
deprecatedThe `cirq-rigetti` subpackage was deprecated and became an opt-in component, requiring explicit installation.
fix
If still using Cirq versions <1.6.0 and needing Rigetti integration, install it explicitly via `pip install cirq-rigetti`. For versions >=1.6.0, refer to the breaking change above.
affects: >=1.5.0, <1.6.0
gotchaA bug in `cirq.kraus` could return erroneous near-zero matrices, potentially affecting simulations or analysis involving Kraus operators.
fix
Upgrade to Cirq v1.6.1 or later to get the fix for the `cirq.kraus` bug.
affects: 1.6.0
gotchaWhile Cirq v1.0.0 brought a commitment to API stability following SemVer, earlier versions (pre-1.0) were in an 'alpha' state with frequent breaking changes between releases.
fix
When working with older Cirq codebases, it is crucial to pin to specific minor versions (`cirq==0.X.Y`) and be prepared for migrations if upgrading to newer major versions. For current development, rely on the stated SemVer compatibility.
affects: <1.0.0
Errors
Common errors & fixes
AttributeError: module 'cirq' has no attribute 'GridQubit'
This error often occurs when a user's Python file is named `cirq.py`, causing Python to import the local file instead of the installed `cirq` library, leading to a module shadowing issue.
fix
Rename your Python file to something other than `cirq.py` (e.g., `my_quantum_program.py`). If the issue persists, ensure Cirq is correctly installed with `pip install cirq-core` or `pip install cirq`.
AttributeError: module 'cirq' has no attribute 'google'
Cirq underwent modularization, and components related to Google's quantum hardware, previously under `cirq.google`, were moved to a separate package, `cirq_google`.
fix
Install the `cirq_google` package (`pip install cirq-google`) and change your import statements from `import cirq.google` to `import cirq_google`.
ModuleNotFoundError: No module named 'cirq'
This error indicates that the `cirq` or `cirq-core` package has not been installed in your Python environment or is not accessible in the current environment's Python path.
fix
Install the `cirq-core` library using pip: `pip install cirq-core`. If you need all optional modules, use `pip install cirq`.
type object 'Circuit' has no attribute 'from_ops'
The `from_ops` method for creating a `cirq.Circuit` has been deprecated in newer versions of Cirq.
fix
Instead of `cirq.Circuit.from_ops(ops)`, you can directly pass the operations as arguments to the `cirq.Circuit` constructor: `cirq.Circuit(*ops)`.
Upgrade
Version history
1.7.0latest on PyPI · released Jun 29, 2026
Audit
Dependencies
pythonrequiredMinimum required Python version for Cirq 1.6.x
cirq-googleoptionalFor integration with Google's quantum processors (e.g., Sycamore, Weber)
cirq-ionqoptionalFor integration with IonQ trapped ion quantum computers
cirq-aqtoptionalFor integration with Alpine Quantum Technologies (AQT) hardware
cirq-pasqaloptionalFor integration with Pasqal neutral atom quantum computers
azure-quantumoptionalFor integration with Azure Quantum (IonQ and Honeywell backends)
Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources