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 cirqVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade your Python environment to 3.11.0 or later. Consider using a virtual environment (e.g., `python -m venv .venv`).
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.
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.
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.
Upgrade to Cirq v1.6.1 or later to get the fix for the `cirq.kraus` bug.
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.
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`.
Install the `cirq_google` package (`pip install cirq-google`) and change your import statements from `import cirq.google` to `import cirq_google`.
Install the `cirq-core` library using pip: `pip install cirq-core`. If you need all optional modules, use `pip install cirq`.
Instead of `cirq.Circuit.from_ops(ops)`, you can directly pass the operations as arguments to the `cirq.Circuit` constructor: `cirq.Circuit(*ops)`.