Search…
Installing Locally
Follow the steps below to use the Forest SDK locally.
Installing locally is most useful for development using a QVM. Running programs against a QPU requires a reservation as well as network access to the QPU (available via your provisioned JupyterLab IDE).

Install the Compiler and QVM

Start by downloading the quilc and qvm binaries for your operating system.
If you'd like to skip installing quilc and qvm locally, you can run them from pre-created Docker images instead. For example:
1
docker run --rm -it -p 5555:5555 rigetti/quilc -P -S
Copied!
1
docker run --rm -it -p 5000:5000 rigetti/qvm -S
Copied!

macOS

To install on macOS, double-click forest-sdk.dmg once it's downloaded. Then double-click forest-sdk.pkg and follow the on-screen instructions.
When you're finished, move on to verify the installation.
To uninstall, remove the following files:
  • /usr/local/bin/qvm
  • /usr/local/bin/quilc
  • /usr/local/share/man/man1/qvm.1
  • /usr/local/share/man/man1/quilc.1

Windows

To install on Windows, double-click forest-sdk.msi once it's downloaded, then follow the on-screen instructions.
When you're finished, move on to verify the installation.
To uninstall:
  1. 1.
    Use the Windows search bar to search for "Add or remove programs"
  2. 2.
    Uninstall the application named "Forest SDK for Windows"

Linux

There are three ways to install on Linux: deb, rpm, or bare-bones.

deb

Unpack the downloaded tarball and change to its resulting directory by running the following in a terminal (replacing <version> with the downloaded version of the SDK):
1
tar -xf forest-sdk-linux-deb.tar.bz2
2
cd forest-sdk-<version>-linux-deb
Copied!
From here, run the following command to complete the install (replacing <version> with the downloaded version of the SDK):
1
sudo ./forest-sdk-<version>-linux-deb.run
Copied!
When you're finished, move on to verify the installation.
To uninstall, run:
1
sudo apt remove forest-sdk
Copied!

rpm

Unpack the downloaded tarball and change to its resulting directory by running the following in a terminal (replacing <version> with the downloaded version of the SDK):
1
tar -xf forest-sdk-linux-rpm.tar.bz2
2
cd forest-sdk-<version>-linux-rpm
Copied!
From here, run the following command to complete the install (replacing <version> with the downloaded version of the SDK):
1
sudo ./forest-sdk-<version>-linux-rpm.run
Copied!
When you're finished, move on to verify the installation.
To uninstall, run:
1
sudo yum uninstall forest-sdk
Copied!
or
1
sudo rpm -e forest-sdk
Copied!

bare-bones

The bare-bones installation only contains the executable binaries and manual pages — it doesn’t contain any of the requisite dynamic libraries. As such, installation doesn’t require administrative or sudo privileges.
First, unpack the downloaded tarball and change to its resulting directory by running the following in a terminal (replacing <version> with the downloaded version of the SDK):
1
tar -xf forest-sdk-linux-barebones.tar.bz2
2
cd forest-sdk-<version>-linux-barebones
Copied!
From here, run the following command to complete the install (replacing <version> with the downloaded version of the SDK):
1
./forest-sdk-<version>-linux-barebones.run
Copied!
Upon successful installation, this will have created a new directory rigetti in your home directory that contains all of the binary and documentation artifacts.
To uninstall, remove the ~/rigetti directory.
This method of installation requires you, through any means, to install shared libraries for BLAS, LAPACK, and libffi.
On a Debian-derivative system, this could be accomplished with:
1
sudo apt-get install liblapack-dev libblas-dev libffi-dev libzmq3-dev
Copied!
Or on any rhel-derivative systems (e.g. Amazon Linux) with:
1
sudo yum install -y lapack-devel blas-devel epel-release
2
sudo yum install -y zeromq3-devel
Copied!

Verify Installation

To check that the binaries were properly installed, run the following commands in a terminal. They should each execute successfully and print version numbers.
1
quilc --version
2
qvm --version
Copied!

Install pyQuil

We publish new versions of pyQuil to PyPI. You can install pyQuil just like any other PyPI package.
pyQuil requires Python 3.7, 3.8, or 3.9
Using pip:
1
pip install pyquil
Copied!
Using poetry:
1
poetry install pyquil
Copied!
If you'd like to install pyQuil from source, see the pyQuil GitHub repository.

Using a Virtual Environment

We highly recommend installing into a virtual environment. For example, you can create a virtual environment named .venv and activate it with the following command prior to installing pyQuil or other packages:
1
python -m venv .venv
2
source .venv/bin/activate
Copied!
To deactivate the virtual environment, run:
1
deactivate
Copied!

Start the Compiler and QVM

Open a terminal window and start the compiler in server mode:
1
quilc -P -S
Copied!
Then, open a second terminal window and start the QVM in server mode:
1
qvm -S
Copied!
For more details on using the quilc and qvm binaries, see the quilc Reference and the QVM Reference.

Run a Program

Now that the compiler and QVM servers are running, try running a simple program. Save the following Python script to a file called pyquil_bell.py:
pyQuil v3
pyQuil v2
1
from pyquil import get_qc, Program
2
from pyquil.gates import H, CNOT, MEASURE
3
from pyquil.quilbase import Declare
4
5
program = Program(
6
Declare("ro", "BIT", 2),
7
H(0),
8
CNOT(0, 1),
9
MEASURE(0, ("ro", 0)),
10
MEASURE(1, ("ro", 1)),
11
).wrap_in_numshots_loop(10)
12
13
qc = get_qc("2q-qvm")
14
15
print(qc.run(qc.compile(program)).readout_data.get("ro"))
Copied!
1
from pyquil import get_qc, Program
2
from pyquil.gates import H, CNOT, MEASURE
3
from pyquil.quilbase import Declare
4
5
program = Program(
6
Declare("ro", "BIT", 2),
7
H(0),
8
CNOT(0, 1),
9
MEASURE(0, ("ro", 0)),
10
MEASURE(1, ("ro", 1)),
11
).wrap_in_numshots_loop(10)
12
13
qc = get_qc("2q-qvm")
14
15
print(qc.run(qc.compile(program)))
Copied!
Then, run your script from a terminal:
1
python pyquil_bell.py
Copied!
If all goes well, you'll see results similar to the following:
1
[[1 1]
2
[0 0]
3
[1 1]
4
[0 0]
5
[1 1]
6
[0 0]
7
[1 1]
8
[1 1]
9
[1 1]
10
[0 0]]
Copied!

Using JupyterLab

If you prefer working with Jupyter notebooks instead of Python files, you can install and run JupyterLab easily by running the following in a terminal:
1
pip install jupyterlab
2
jupyter lab
Copied!
We recommend doing this from a virtual environment.
If you're not familiar with using JupyterLab, we recommend this handy guide.
Last modified 4mo ago