Installing Cirq

Choose your operating system:

If you want to create a development environment, see development.md.


Alpha Disclaimer

Cirq is currently in alpha. We are still making breaking changes. We will break your code when we make new releases. We recommend that you target a specific version of Cirq, and periodically bump to the latest release. That way you have control over when a breaking change affects you.

Installing on Linux

  1. Make sure you have python 3.5.2 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 system dependencies that pip can’t handle.

    sudo apt-get install python3-tk texlive-latex-base latexmk
    
    • Without python3-tk, plotting functionality won’t work.
    • Without texlive-latex-base and latexmk, pdf writing functionality will not work.
  5. Check that it works!

    python -c 'import cirq; print(cirq.google.Foxtail)'
    # should print:
    # (0, 0)───(0, 1)───(0, 2)───(0, 3)───(0, 4)───(0, 5)───(0, 6)───(0, 7)───(0, 8)───(0, 9)───(0, 10)
    # │        │        │        │        │        │        │        │        │        │        │
    # │        │        │        │        │        │        │        │        │        │        │
    # (1, 0)───(1, 1)───(1, 2)───(1, 3)───(1, 4)───(1, 5)───(1, 6)───(1, 7)───(1, 8)───(1, 9)───(1, 10)
    

Installing on Mac OS X

  1. Make sure you have python 3.5 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. Check that it works!

    python -c 'import cirq; print(cirq.google.Foxtail)'
    # should print:
    # (0, 0)───(0, 1)───(0, 2)───(0, 3)───(0, 4)───(0, 5)───(0, 6)───(0, 7)───(0, 8)───(0, 9)───(0, 10)
    # │        │        │        │        │        │        │        │        │        │        │
    # │        │        │        │        │        │        │        │        │        │        │
    # (1, 0)───(1, 1)───(1, 2)───(1, 3)───(1, 4)───(1, 5)───(1, 6)───(1, 7)───(1, 8)───(1, 9)───(1, 10)
    

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.5 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. Check that it works!

    python -c "import cirq; print(cirq.google.Foxtail)"
    # should print:
    # (0, 0)───(0, 1)───(0, 2)───(0, 3)───(0, 4)───(0, 5)───(0, 6)───(0, 7)───(0, 8)───(0, 9)───(0, 10)
    # │        │        │        │        │        │        │        │        │        │        │
    # │        │        │        │        │        │        │        │        │        │        │
    # (1, 0)───(1, 1)───(1, 2)───(1, 3)───(1, 4)───(1, 5)───(1, 6)───(1, 7)───(1, 8)───(1, 9)───(1, 10)
    

Installing on Docker

This will use a Docker image that will isolate Cirq’s installation from the rest of the system.

  1. Install Docker on your host sytem.

  2. Pull the docker image:

    docker pull quantumlib/cirq
    
  3. Check that it works!

    docker run -it quantumlib/cirq python -c "import cirq; print(cirq.google.Foxtail)"
    # should print:
    # (0, 0)───(0, 1)───(0, 2)───(0, 3)───(0, 4)───(0, 5)───(0, 6)───(0, 7)───(0, 8)───(0, 9)───(0, 10)
    # │        │        │        │        │        │        │        │        │        │        │
    # │        │        │        │        │        │        │        │        │        │        │
    # (1, 0)───(1, 1)───(1, 2)───(1, 3)───(1, 4)───(1, 5)───(1, 6)───(1, 7)───(1, 8)───(1, 9)───(1, 10)
    
  4. To run the image:

    docker run -it quantumlib/cirq