{"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":"python","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,"search_vec":"'1.6.1':60 'activ':50 'ai':12,70 'circuit':24,35,65 'cirq':1,2 'comput':62 'control':32 'creat':15 'current':43,57 'current-gener':42 'develop':7 'edit':16 'fine':30 'fine-tun':29 'focus':26 'framework':6 'frequent':53 'gate':38 'gate-level':37 'generat':44 'googl':9,68 'intermedi':20 'invok':18 'level':39 'librari':48 'maintain':51 'nisq':23,63 'noisi':19 'oper':40 'processor':46 'provid':28 'python':5 'quantum':11,22,34,45,61,64,66,69 'releas':54 'scale':21 'simul':67 'team':13 'tune':31 'version':59","created_at":"2026-04-14T05:05:38.635894+00:00","updated_at":"2026-04-16T02:11:39.735277+00:00","problems":[{"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`.","cause":"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.","error":"AttributeError: module 'cirq' has no attribute 'GridQubit'"},{"fix":"Install the `cirq_google` package (`pip install cirq-google`) and change your import statements from `import cirq.google` to `import cirq_google`.","cause":"Cirq underwent modularization, and components related to Google's quantum hardware, previously under `cirq.google`, were moved to a separate package, `cirq_google`.","error":"AttributeError: module 'cirq' has no attribute 'google'"},{"fix":"Install the `cirq-core` library using pip: `pip install cirq-core`. If you need all optional modules, use `pip install cirq`.","cause":"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.","error":"ModuleNotFoundError: No module named '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)`.","cause":"The `from_ops` method for creating a `cirq.Circuit` has been deprecated in newer versions of Cirq.","error":"type object 'Circuit' has no attribute 'from_ops'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.7.0","cli_name":"cirq","cli_version":"sh: 1: cirq: not found","type":"library","homepage":"https://quantumai.google/cirq","github":"http://github.com/quantumlib/cirq","docs":null,"changelog":null,"pypi":"https://pypi.org/project/cirq-core/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}