Choose your operating system:
If you want to create a development environment, see the development page.
Python version support
Cirq currently supports Python 3.10 and later. We follow NumPy's schedule for Python version support defined in NEP 29, though we may deviate from that schedule by extending support for older Python versions if they are needed by Colab or internal Google systems.
Installing on Linux
Make sure you have Python 3.10.0 or greater.
See Installing Python 3 on Linux in The Hitchhiker's Guide to Python.
Consider using a virtual environment.
Use
pip
to installcirq
:python -m pip install --upgrade pip python -m pip install cirq
(Optional) install other dependencies.
Install dependencies of features in
cirq.contrib
.python -m pip install 'cirq-core[contrib]'
Install system dependencies that
pip
can't handle, such astexlive-latex-base
to support PDF printing. For Debian-based Linux systems, the necessary packages can be installed using the following command from the top level of the Cirq repository:sudo apt install $(cat apt-system-requirements.txt)
Check that it works!
python -c 'import cirq_google; print(cirq_google.Sycamore)' # should print: # (0, 5)───(0, 6) # │ │ # │ │ # (1, 4)───(1, 5)───(1, 6)───(1, 7) # │ │ │ │ # │ │ │ │ # (2, 3)───(2, 4)───(2, 5)───(2, 6)───(2, 7)───(2, 8) # │ │ │ │ │ │ # │ │ │ │ │ │ # (3, 2)───(3, 3)───(3, 4)───(3, 5)───(3, 6)───(3, 7)───(3, 8)───(3, 9) # │ │ │ │ │ │ │ │ # │ │ │ │ │ │ │ │ # (4, 1)───(4, 2)───(4, 3)───(4, 4)───(4, 5)───(4, 6)───(4, 7)───(4, 8)───(4, 9) # │ │ │ │ │ │ │ │ # │ │ │ │ │ │ │ │ # (5, 0)───(5, 1)───(5, 2)───(5, 3)───(5, 4)───(5, 5)───(5, 6)───(5, 7)───(5, 8) # │ │ │ │ │ │ │ # │ │ │ │ │ │ │ # (6, 1)───(6, 2)───(6, 3)───(6, 4)───(6, 5)───(6, 6)───(6, 7) # │ │ │ │ │ # │ │ │ │ │ # (7, 2)───(7, 3)───(7, 4)───(7, 5)───(7, 6) # │ │ │ # │ │ │ # (8, 3)───(8, 4)───(8, 5) # │ # │ # (9, 4)
Installing on MacOS
Make sure you have Python 3.10.0 or greater.
Consider using a virtual environment.
Use
pip
to installcirq
:python -m pip install --upgrade pip python -m pip install cirq
(Optional) install dependencies of features in
cirq.contrib
.python -m pip install 'cirq-core[contrib]'
Install system dependencies that
pip
can't handle.brew install --cask mactex
- Without
mactex
, functionality for writing PDF files will not work.
- Without
Check that it works!
python -c 'import cirq_google; print(cirq_google.Sycamore)' # should print: # (0, 5)───(0, 6) # │ │ # │ │ # (1, 4)───(1, 5)───(1, 6)───(1, 7) # │ │ │ │ # │ │ │ │ # (2, 3)───(2, 4)───(2, 5)───(2, 6)───(2, 7)───(2, 8) # │ │ │ │ │ │ # │ │ │ │ │ │ # (3, 2)───(3, 3)───(3, 4)───(3, 5)───(3, 6)───(3, 7)───(3, 8)───(3, 9) # │ │ │ │ │ │ │ │ # │ │ │ │ │ │ │ │ # (4, 1)───(4, 2)───(4, 3)───(4, 4)───(4, 5)───(4, 6)───(4, 7)───(4, 8)───(4, 9) # │ │ │ │ │ │ │ │ # │ │ │ │ │ │ │ │ # (5, 0)───(5, 1)───(5, 2)───(5, 3)───(5, 4)───(5, 5)───(5, 6)───(5, 7)───(5, 8) # │ │ │ │ │ │ │ # │ │ │ │ │ │ │ # (6, 1)───(6, 2)───(6, 3)───(6, 4)───(6, 5)───(6, 6)───(6, 7) # │ │ │ │ │ # │ │ │ │ │ # (7, 2)───(7, 3)───(7, 4)───(7, 5)───(7, 6) # │ │ │ # │ │ │ # (8, 3)───(8, 4)───(8, 5) # │ # │ # (9, 4)
Installing on Windows
If you are using the Windows Subsystem for Linux, use the Linux install instructions instead of these instructions.
Make sure you have Python 3.10.0 or greater.
See Installing Python 3 on Windows in The Hitchhiker's Guide to Python.
Use
pip
to installcirq
:python -m pip install --upgrade pip python -m pip install cirq
(Optional) install dependencies of features in
cirq.contrib
.python -m pip install 'cirq-core[contrib]'
Check that it works!
python -c "import cirq_google; print(cirq_google.Sycamore)" # should print: # (0, 5)───(0, 6) # │ │ # │ │ # (1, 4)───(1, 5)───(1, 6)───(1, 7) # │ │ │ │ # │ │ │ │ # (2, 3)───(2, 4)───(2, 5)───(2, 6)───(2, 7)───(2, 8) # │ │ │ │ │ │ # │ │ │ │ │ │ # (3, 2)───(3, 3)───(3, 4)───(3, 5)───(3, 6)───(3, 7)───(3, 8)───(3, 9) # │ │ │ │ │ │ │ │ # │ │ │ │ │ │ │ │ # (4, 1)───(4, 2)───(4, 3)───(4, 4)───(4, 5)───(4, 6)───(4, 7)───(4, 8)───(4, 9) # │ │ │ │ │ │ │ │ # │ │ │ │ │ │ │ │ # (5, 0)───(5, 1)───(5, 2)───(5, 3)───(5, 4)───(5, 5)───(5, 6)───(5, 7)───(5, 8) # │ │ │ │ │ │ │ # │ │ │ │ │ │ │ # (6, 1)───(6, 2)───(6, 3)───(6, 4)───(6, 5)───(6, 6)───(6, 7) # │ │ │ │ │ # │ │ │ │ │ # (7, 2)───(7, 3)───(7, 4)───(7, 5)───(7, 6) # │ │ │ # │ │ │ # (8, 3)───(8, 4)───(8, 5) # │ # │ # (9, 4)