Installation#

Quick and simple#

If you just want a simple, fast, convenient installation, running

pip install pyquest

will do the trick in most cases. This fetches a CPU-only multi-threaded pyQuEST version from PyPI and installs it in your current Python environment. It is recommended to use virtual environments for this to reduce package conflicts.

Custom installation#

For a more customised installation, where you get to choose to use only a single thread (good for very small quantum registers), a GPU for massive parallelisation, or multiple distributed nodes via MPI for very large quantum systems, you will need to compile the package from source yourself. The instructions below are fairly comprehensive, but occasionally some troubleshooting will be required. Some of the most common errors are mentioned as notes in between the instructions.

First, make sure you have a working Python 3 installation (preferably including pip), some version of git, and working C and C++ compilers.

Then we can open a terminal session and get a copy of the source code from github

git clone https://github.com/rrmeister/pyquest --recursive

Be sure to include the --recursive option, as this downloads the QuEST package alongside the Python interface. After changing into the pyquest

cd pyquest

we can customise pyQuEST before installation. The simplest way is to open the setup.py file in your favourite text editor and look at the following (fairly self-descriptive) section

quest_config = {
    'precision': 2,            # Size of a float; 1 (single),
                               # 2 (double), or 4 (quad precision).
    'multithreaded': True,     # Enable multithreading via OpenMP.
    'distributed': False,      # Enable distributed code via MPI.
    'gpu_accelerated': False,  # Enable Nvidia GPU support via CUDA.
    # CUDA needs to know the compute capability of your GPU. Find your
    # GPU model on https://developer.nvidia.com/cuda-gpus and set
    # 'gpu_compute_capability' to the "Compute Capability" listed
    # there, without the period (e.g. 30 for 3.0).
    'gpu_compute_capability': None,
}

After setting the approprate values, you can also change environment variables to provide the correct compilers, linkers, library paths, etc.

Note

Make sure you have the CUDA compiler nvcc installed when compiling pyQuEST for use with your Nvidia GPU, and that it is compatible with the C++ compiler you are using.

Compile and install using pip#

Even when compiling from source, pip can take care of most of the installation process, including installing temporary packages and creating an isolated build environment. Simply run

pip install .

from within the pyQuEST root directory, and pip should install pyQuEST into your current Python environment with the compile options you just set.