# Install Locally

Follow the steps below to use the [Quil SDK](https://docs.rigetti.com/qcs/master#quil-sdk) locally.

{% hint style="info" %}
Installing locally is most useful for development using a QVM. Running programs against a QPU requires a [reservation](https://docs.rigetti.com/qcs/guides/access-a-qpu/reserving-time-on-a-qpu) as well as network access to the QPU (available via your provisioned [JupyterLab IDE](https://docs.rigetti.com/qcs/getting-started/set-up-your-environment/jupyterlab-ide)).
{% endhint %}

## Install the Compiler and QVM

Start by [downloading the `quilc` and `qvm` binaries](https://qcs.rigetti.com/sdk-downloads) for your operating system.

{% hint style="success" %}
If you'd like to skip installing `quilc` and `qvm` locally, you can run them from pre-created [Docker](https://www.docker.com/products/docker-desktop) images instead. For example:

```bash
docker run --rm -it -p 5555:5555 rigetti/quilc -P -S
```

```bash
docker run --rm -it -p 5000:5000 rigetti/qvm -S
```

{% endhint %}

{% hint style="info" %}
If you want to avoid installing anything locally, you can use Docker to run a pre-built image with the entirety of the Quil SDK and JupyterLab pre-installed. See [forest-docker-image](https://docs.rigetti.com/qcs/getting-started/set-up-your-environment/installing-locally/forest-docker-image "mention")for setup instructions.
{% endhint %}

Start by [downloading the `quilc` and `qvm` binaries](https://qcs.rigetti.com/sdk-downloads) for your operating system. Then, follow the instructions for your platform to install them:

<details>

<summary>macOS</summary>

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.

***

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`

</details>

<details>

<summary>Windows</summary>

To install on Windows, double-click `forest-sdk.msi` once it's downloaded, then follow the on-screen instructions.

***

* Use the Windows search bar to search for "Add or remove programs"
* Uninstall the application named "Forest SDK for Windows"

</details>

<details>

<summary>Linux</summary>

There are three ways to install on Linux: [deb](#deb), [rpm](#rpm), or [bare-bones](#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):

```bash
tar -xf forest-sdk-linux-deb.tar.bz2
cd forest-sdk-<version>-linux-deb
```

From here, run the following command to complete the install (replacing `<version>` with the downloaded version of the SDK):

```bash
sudo ./forest-sdk-<version>-linux-deb.run
```

When you're finished, move on to [verify the installation](#verify-installation).

***

To uninstall, run:

```bash
sudo apt remove forest-sdk
```

#### 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):

```bash
tar -xf forest-sdk-linux-rpm.tar.bz2
cd forest-sdk-<version>-linux-rpm
```

From here, run the following command to complete the install (replacing `<version>` with the downloaded version of the SDK):

```bash
sudo ./forest-sdk-<version>-linux-rpm.run
```

When you're finished, move on to [verify the installation](#verify-installation).

***

To uninstall, run:

```bash
sudo yum uninstall forest-sdk
```

or

```bash
sudo rpm -e forest-sdk
```

#### 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):

```bash
tar -xf forest-sdk-linux-barebones.tar.bz2
cd forest-sdk-<version>-linux-barebones
```

From here, run the following command to complete the install (replacing `<version>` with the downloaded version of the SDK):

```bash
./forest-sdk-<version>-linux-barebones.run
```

Upon successful installation, this will have created a new directory `rigetti` in your home directory that contains all of the binary and documentation artifacts.

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:

```bash
sudo apt-get install liblapack-dev libblas-dev libffi-dev libzmq3-dev
```

&#x20;Or on any rhel-derivative systems (e.g. Amazon Linux) with:

```bash
sudo yum install -y lapack-devel blas-devel epel-release
sudo yum install -y zeromq3-devel
```

***

To uninstall, remove the `~/rigetti` directory.

</details>

### 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.

```bash
quilc --version
qvm --version
```

## Install pyQuil

We publish new versions of pyQuil to [PyPI](https://pypi.org/project/pyquil). You can install pyQuil just like any other PyPI package.

{% hint style="warning" %}
pyQuil requires Python 3.8 or greater.
{% endhint %}

Using `pip`:

```bash
pip install pyquil
```

Using `poetry`:

```bash
poetry install pyquil
```

{% hint style="info" %}
If you'd like to install pyQuil from source, see the [pyQuil GitHub repository](https://github.com/rigetti/pyquil).
{% endhint %}

### Using a Virtual Environment

We highly recommend installing into a [virtual environment](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments). For example, you can create a virtual environment named `.venv` and activate it with the following command prior to installing pyQuil or other packages:

```
python -m venv .venv
source .venv/bin/activate
```

{% hint style="info" %}
To deactivate the virtual environment, run:

```
deactivate
```

{% endhint %}

## Start the Compiler and QVM

Open a terminal window and start the compiler in server mode:

```bash
quilc -P -S
```

Then, open a second terminal window and start the QVM in server mode:

```bash
qvm -S
```

{% hint style="info" %}
For more details on using the `quilc` and `qvm` binaries, see the [quilc Reference](https://docs.rigetti.com/qcs/references/quilc) and the [QVM Reference](https://docs.rigetti.com/qcs/references/qvm).
{% endhint %}

## Run a Program

Now that the compiler and QVM servers are running, you are ready to [run your first program with pyQuil](https://pyquil-docs.rigetti.com/en/stable/getting_started.html#run-your-first-program)!
