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 may change or remove parts of Cirq’s API when making new releases. To be informed of deprecations and breaking changes, subscribe to the cirq-announce google group mailing list.

Installing on Linux

  1. Make sure you have python 3.6.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[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; 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. (Optional) install dependencies of features in cirq.contrib.

    python -m pip install cirq[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; 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. (Optional) install dependencies of features in cirq.contrib.

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