{"id":9581,"library":"cirq","title":"Cirq Quantum Computing Framework","description":"Cirq is an open-source Python framework developed by Google for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits. It provides tools for designing quantum algorithms and running them on simulators or quantum hardware. Cirq maintains an active release schedule, typically with major updates every 1-2 months, focusing on new features, performance improvements, and compatibility with Google's quantum hardware.","status":"active","version":"1.6.1","language":"en","source_language":"en","source_url":"https://github.com/quantumlib/cirq","tags":["quantum computing","NISQ","simulator","Google","qubit","circuit"],"install":[{"cmd":"pip install cirq","lang":"bash","label":"Install latest Cirq"}],"dependencies":[{"reason":"Minimum Python version required for Cirq >= 1.6.0","package":"python","optional":false},{"reason":"Core numerical operations; compatibility with NumPy 2.x added in Cirq 1.5.0","package":"numpy","optional":false}],"imports":[{"symbol":"Circuit","correct":"import cirq\ncircuit = cirq.Circuit(...)"},{"symbol":"Simulator","correct":"import cirq\nsimulator = cirq.Simulator()"},{"symbol":"GridQubit","correct":"import cirq\nq = cirq.GridQubit(0, 0)"},{"symbol":"H","correct":"import cirq\ncircuit = cirq.Circuit(cirq.H(q))"},{"note":"The `cirq-rigetti` subpackage was removed from the main `cirq` installation in v1.5.0 and fully removed in v1.6.0. It must now be installed separately for legacy access to v1.5.0 functionality, or use newer Rigetti SDKs.","wrong":"import cirq.rigetti","symbol":"rigetti","correct":"pip install cirq-rigetti==1.5.0\nimport cirq_rigetti"},{"note":"The `cirq-ft` package was moved from `cirq` to its own repository and is now part of the `qualtran` library. Direct imports from `cirq_ft` will fail in recent Cirq versions.","wrong":"import cirq_ft","symbol":"cirq_ft","correct":"pip install qualtran\nimport qualtran"}],"quickstart":{"code":"import cirq\n\n# Define a qubit\nq0 = cirq.GridQubit(0, 0)\n\n# Create a quantum circuit for a Bell state\ncircuit = cirq.Circuit(\n    cirq.H(q0),        # Apply Hadamard gate\n    cirq.CNOT(q0, cirq.GridQubit(0, 1)), # Apply CNOT with another qubit\n    cirq.measure(q0, cirq.GridQubit(0, 1), key='result') # Measure both qubits\n)\n\nprint(\"Circuit:\")\nprint(circuit)\n\n# Simulate the circuit\nsimulator = cirq.Simulator()\nresult = simulator.run(circuit, repetitions=100) # Run 100 times\n\nprint(\"\\nResults:\")\nprint(result.histogram(key='result')) # Print measurement outcome histogram","lang":"python","description":"This quickstart demonstrates how to construct a simple Bell state quantum circuit, print its representation, and then simulate it using Cirq's built-in simulator to obtain measurement results."},"warnings":[{"fix":"For legacy code requiring `cirq-rigetti`, explicitly install `cirq-rigetti==1.5.0`. For new development, use Rigetti's current SDK or relevant integration libraries.","message":"The `cirq-rigetti` subpackage was fully removed from Cirq as of v1.6.0. Attempts to import it from `cirq` will fail.","severity":"breaking","affected_versions":">=1.6.0"},{"fix":"Install `qualtran` (`pip install qualtran`) and import functionality from there. Replace `cirq_ft` imports with `qualtran`.","message":"The `cirq-ft` package was removed from Cirq as of v1.4.0, having moved to its own repository under the `qualtran` library. Direct imports will fail.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Upgrade your Python environment to version 3.11 or newer. If you must use an older Python version, pin Cirq to `<1.6.0`.","message":"Cirq v1.6.0 and later versions require Python 3.11 or higher.","severity":"breaking","affected_versions":">=1.6.0"},{"fix":"Ensure you are using Cirq v1.5.0 or newer when working with NumPy 2.x. If using an older Cirq version, pin NumPy to `<2.0.0`.","message":"Support for NumPy 2.x was added in Cirq v1.5.0. Older Cirq versions may have compatibility issues or breakages if used with NumPy 2.x.","severity":"gotcha","affected_versions":"<1.5.0"},{"fix":"Consult the official Cirq migration guides for updates related to major version changes. Update your code to use the modern v1.x API.","message":"Cirq has undergone significant API stabilization since its v1.0.0 release. Code written for pre-1.0 versions may use deprecated or removed symbols.","severity":"gotcha","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"If you require `cirq-rigetti`, install its last standalone version: `pip install cirq-rigetti==1.5.0`.","cause":"The `cirq-rigetti` subpackage was removed from Cirq's main distribution in v1.6.0.","error":"ModuleNotFoundError: No module named 'cirq.rigetti'"},{"fix":"Install the `qualtran` library: `pip install qualtran`. Update your imports to reference `qualtran` instead of `cirq_ft`.","cause":"The fault-tolerant functionality moved to the separate `qualtran` library.","error":"ModuleNotFoundError: No module named 'cirq_ft'"},{"fix":"Upgrade your Python environment to 3.11 or newer. Alternatively, install an older compatible Cirq version, e.g., `pip install 'cirq<1.6.0'`.","cause":"Cirq v1.6.0 and later require a minimum Python version of 3.11.","error":"Your Python version is 3.10.x but cirq requires >=3.11.0."},{"fix":"Upgrade Cirq to v1.5.0 or newer (`pip install --upgrade cirq`), which added NumPy 2.x compatibility. Or, downgrade NumPy to a version prior to 2.0 (`pip install 'numpy<2.0.0'`).","cause":"Commonly occurs when using an older Cirq version with NumPy 2.x, which changed some array behaviors.","error":"TypeError: 'numpy.ndarray' object is not callable"}]}