Registry / gcp / cirq-google

cirq-google

JSON →
library1.6.1pypypiunverified

Cirq Google (`cirq-google`) is the module for the Cirq quantum computing framework that provides tools and access to the Google Quantum Computing Service. It enables users to run quantum circuits on Google's quantum processors and high-performance simulators. The current version is 1.6.1, and it typically releases new versions in sync with the main `cirq` library, which has a release cadence of monthly/bi-monthly patches and quarterly minor versions.

pip install cirq cirq-google
INSTALL
IMPORT
SIG · CIRQ-GOOGLE
C
cirq-google
gcppythonv1.6.1
Install
28.3s avg
Import
Disk
606MB
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
✕ build_error
✓ 31.5s
py 3.11
✕ build_error
✓ 29.75s
py 3.12
✕ build_error
✓ 28.25s
py 3.13
✕ build_error
✓ 28.45s
py 3.9
✓ 0.1s
✓ 51.9s
606MB installed
● package 606MB
Code
Verified usage

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

QuantumEngine
from cirq_google import QuantumEngine
The primary entry point for interacting with Google's Quantum Engine.
Sycamore
from cirq_google.devices import Sycamore
Example of importing a specific Google quantum device model.

This quickstart demonstrates how to initialize the `QuantumEngine` client and run a simple Cirq circuit. For actual remote execution, ensure your Google Cloud environment is authenticated and `GOOGLE_CLOUD_PROJECT` (or a hardcoded project ID) is correctly configured. The example includes a fallback to a local Cirq simulator for immediate runnability without a full GCP setup.

import cirq import cirq_google import os # Replace with your Google Cloud Project ID (e.g., 'your-project-id') # For local testing, any string can be used, but for actual hardware access, # it must be a valid GCP project ID with Quantum Engine API enabled. PROJECT_ID = os.environ.get("GOOGLE_CLOUD_PROJECT", "gcp-project-for-cirq-testing") try: # Initialize the QuantumEngine client # This assumes you have authenticated via 'gcloud auth application-default login' # or set the GOOGLE_APPLICATION_CREDENTIALS environment variable. print(f"Attempting to initialize QuantumEngine for project: {PROJECT_ID}") engine = cirq_google.QuantumEngine(project_id=PROJECT_ID) # For quickstart, we'll try to use a local simulator # For actual hardware/remote simulator usage, you would use: # processor = engine.get_processor('willow_pink') # Example processor # job = engine.run_circuit(program=circuit, processor_ids=[processor.name], repetitions=10) # results = job.results() # Define a simple circuit qubit = cirq.GridQubit(0, 0) circuit = cirq.Circuit( cirq.H(qubit), cirq.measure(qubit, key='m') ) # Run the circuit on a local Cirq simulator for quick demonstration print("Running circuit on local Cirq simulator...") simulator = cirq.Simulator() results = simulator.run(circuit, repetitions=10) print("Local simulation results:") print(results) except Exception as e: print(f"Could not initialize QuantumEngine or connect to remote resources ({e}).") print("Falling back to local Cirq simulator for demonstration.") # Define a simple circuit qubit = cirq.GridQubit(0, 0) circuit = cirq.Circuit( cirq.H(qubit), cirq.measure(qubit, key='m') ) # Run the circuit on a local Cirq simulator simulator = cirq.Simulator() results = simulator.run(circuit, repetitions=10) print("Local simulation results (fallback):") print(results)
Debug
Known issues
breakingCirq-Rigetti subpackage has been removed. If your project depends on `cirq-rigetti`, you must use an older version of Cirq (e.g., `cirq-rigetti-1.5.0`) or install `cirq-rigetti` explicitly if available.
fix
For new projects, avoid `cirq-rigetti`. For legacy code, pin `cirq-rigetti==1.5.0` and `cirq<1.6.0` or update your code to use the standalone `pyquil` library if applicable. `cirq-rigetti` was deprecated in v1.5.0 and removed in v1.6.0.
affects: >=1.6.0
breakingThe minimum required Python version has been increased to 3.11.0. Older Python versions (e.g., 3.10 or earlier) are no longer supported.
fix
Upgrade your Python environment to 3.11.0 or higher. For example, using `pyenv install 3.11.8` and `pyenv local 3.11.8` or `conda install python=3.11`.
affects: >=1.6.0
breakingThe `cirq-ft` package was removed. Its functionality has moved to the `Qualtran` repository.
fix
For fault-tolerant quantum algorithm resource estimation, use the `Qualtran` library directly from `https://github.com/quantumlib/Qualtran.git`. `cirq-ft` was deprecated in v1.3.0 and removed in v1.4.0.
affects: >=1.4.0
gotchaAuthentication to Google Quantum Engine requires setting up Google Cloud credentials. Without proper authentication, `cirq_google.QuantumEngine` initialization or usage will fail.
fix
Run `gcloud auth application-default login` in your terminal, or set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable pointing to a service account key JSON file. Ensure your GCP project has the Quantum Engine API enabled.
affects: All
Upgrade
Version history
1.6.1latest on PyPI · released Aug 14, 2025
Audit
Dependencies
cirqrequiredcirq-google is a plugin for the core Cirq library and requires it to be installed.
pythonrequiredRequires Python version 3.11 or newer since cirq v1.6.0.
Agent activity
42 hits · last 30 days
node
34
OpenAI (training)
1
Resources