{"id":5756,"library":"cirq-core","title":"Cirq","description":"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.","status":"active","version":"1.6.1","language":"en","source_language":"en","source_url":"http://github.com/quantumlib/cirq","tags":["quantum computing","NISQ","quantum circuits","quantum simulation","Google Quantum AI"],"install":[{"cmd":"pip install cirq","lang":"bash","label":"Recommended (includes core + optional modules)"},{"cmd":"pip install cirq-core","lang":"bash","label":"Core module only"}],"dependencies":[{"reason":"Minimum required Python version for Cirq 1.6.x","package":"python","optional":false},{"reason":"For integration with Google's quantum processors (e.g., Sycamore, Weber)","package":"cirq-google","optional":true},{"reason":"For integration with IonQ trapped ion quantum computers","package":"cirq-ionq","optional":true},{"reason":"For integration with Alpine Quantum Technologies (AQT) hardware","package":"cirq-aqt","optional":true},{"reason":"For integration with Pasqal neutral atom quantum computers","package":"cirq-pasqal","optional":true},{"reason":"For integration with Azure Quantum (IonQ and Honeywell backends)","package":"azure-quantum","optional":true}],"imports":[{"note":"The main top-level package for all core functionalities.","symbol":"cirq","correct":"import cirq"},{"note":"Many common classes and functions are exposed directly under the `cirq` namespace for convenience, avoiding deeper module imports.","wrong":"from cirq.devices import LineQubit","symbol":"LineQubit","correct":"import cirq\n# ...\nq0, q1 = cirq.LineQubit.range(2)"},{"note":"Simulators are often accessed directly via `cirq.Simulator`.","wrong":"from cirq.simulators import Simulator","symbol":"Simulator","correct":"import cirq\n# ...\nsimulator = cirq.Simulator()"}],"quickstart":{"code":"import cirq\nimport numpy as np\n\n# Create two qubits\nq0, q1 = cirq.LineQubit.range(2)\n\n# Build a simple Bell state circuit\ncircuit = cirq.Circuit(\n    cirq.H(q0),\n    cirq.CNOT(q0, q1),\n    cirq.measure(q0, q1, key='result')\n)\n\nprint(\"Circuit:\")\nprint(circuit)\n\n# Simulate the circuit 1000 times\nsimulator = cirq.Simulator()\nresult = simulator.run(circuit, repetitions=1000)\n\n# Display the measurement results\nprint(\"\\nMeasurement results (histogram):\")\nprint(result.histogram(key='result'))","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python environment to 3.11.0 or later. Consider using a virtual environment (e.g., `python -m venv .venv`).","message":"The minimum required Python version has been increased to 3.11.0. Older Python versions are no longer supported.","severity":"breaking","affected_versions":">=1.6.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.","message":"The `cirq-rigetti` subpackage has been completely removed from the main `cirq` distribution. It was previously deprecated in v1.5.0.","severity":"breaking","affected_versions":">=1.6.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.","message":"The `cirq-ft` package (for fault-tolerant resource estimation) was removed from Cirq. It was deprecated in v1.3.0.","severity":"breaking","affected_versions":">=1.4.0"},{"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.","message":"The `cirq-rigetti` subpackage was deprecated and became an opt-in component, requiring explicit installation.","severity":"deprecated","affected_versions":">=1.5.0, <1.6.0"},{"fix":"Upgrade to Cirq v1.6.1 or later to get the fix for the `cirq.kraus` bug.","message":"A bug in `cirq.kraus` could return erroneous near-zero matrices, potentially affecting simulations or analysis involving Kraus operators.","severity":"gotcha","affected_versions":"1.6.0"},{"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.","message":"While 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.","severity":"gotcha","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}