Cirq-Web
raw JSON → 1.6.1 verified Mon Apr 27 auth: no python
Cirq-web provides web-based 3D visualization tools for quantum circuits and related objects using Three.js, integrated with Google's Cirq quantum computing framework. Current version is 1.6.1. Release cadence follows Cirq releases; the package is part of the Cirq suite but published separately on PyPI.
pip install cirq-web Common errors
error ModuleNotFoundError: No module named 'cirq_web' ↓
cause cirq-web is not installed; it is a separate package from cirq-core.
fix
Run 'pip install cirq-web'
error ImportError: cannot import name 'Circuit3D' from 'cirq.web' ↓
cause Incorrect import path: users often try 'from cirq.web import ...' instead of 'from cirq_web import ...'.
fix
Use 'from cirq_web import Circuit3D'
Warnings
gotcha cirq-web is not included automatically when installing the main 'cirq' package. You must install it separately with 'pip install cirq-web'. ↓
fix Run 'pip install cirq-web' explicitly.
gotcha The Python module name uses an underscore, not a dot: import from 'cirq_web' not 'cirq.web'. ↓
fix Use 'from cirq_web import ...'
deprecated Some visualization classes may be deprecated or renamed in future Cirq versions; check the cirq-web release notes for breaking changes. ↓
fix Refer to the official cirq-web documentation and GitHub releases.
Imports
- Circuit3D wrong
from cirq.web import Circuit3Dcorrectfrom cirq_web import Circuit3D - BlochSphere
from cirq_web import BlochSphere
Quickstart
import cirq
from cirq_web import Circuit3D
# Create a simple circuit
q0, q1 = cirq.LineQubit.range(2)
circuit = cirq.Circuit(
cirq.H(q0),
cirq.CNOT(q0, q1),
cirq.measure(q0, q1, key='result')
)
# Visualize as 3D circuit
Circuit3D(circuit)