Install

Choose your operating system:

If you want to create a development environment, see the development page.


Python version supprt

Cirq currently supports python 3.7 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

  1. Make sure you have python 3.7.0 or greater.

    See Installing Python 3 on Linux @ the hitchhiker's guide to python.

  2. Consider using a virtual environment.

  3. Use pip to install cirq:

    python -m pip install --upgrade pip
    python -m pip install cirq
    
  4. (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.

    sudo apt-get install texlive-latex-base latexmk
    
    • Without texlive-latex-base and latexmk, pdf writing functionality will not work.
  5. 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 Mac OS X

  1. Make sure you have python 3.7.0 or greater.

    See Installing Python 3 on Mac OS X @ the hitchhiker's guide to python.

  2. Consider using a virtual environment.

  3. Use pip to install cirq:

    python -m pip install --upgrade pip
    python -m pip install cirq
    
  4. (Optional) install dependencies of features in cirq.contrib.

    python -m pip install cirq-core[contrib]
    

    Install system dependencies that pip can't handle.

    brew cask install mactex
    
    • Without mactex, pdf writing functionality will not work.
  5. 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

  1. If you are using the Windows Subsystem for Linux, use the Linux install instructions instead of these instructions.

  2. Make sure you have python 3.7.0 or greater.

    See Installing Python 3 on Windows @ the hitchhiker's guide to python.

  3. Use pip to install cirq:

    python -m pip install --upgrade pip
    python -m pip install cirq
    
  4. (Optional) install dependencies of features in cirq.contrib.

    python -m pip install cirq-core[contrib]
    
  5. 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)