Installation instructions#

Operating systems support#

In the table below we summarize the status of pre-compiled binaries distributed with pypi for the packages listed above.

Operating System

qibo

qibojit

tensorflow

Linux x86

Yes

Yes

Yes

MacOS >= 10.15

Yes

Yes

Yes

Windows

Yes

Yes

Yes

Note

All packages are supported for Python >= 3.9.

Backend installation#

qibo#

The qibo is the base required package which includes the language API and a lightweight cross-platform simulator based on numpy. In order to accelerate simulation please consider specialized backends listed in Simulation backends.

Installing with pip#

The installation using pip is the recommended approach to install Qibo. Make sure you have Python 3.9 or greater, then use pip to install qibo with:

pip install qibo

The pip program will download and install all the required dependencies for Qibo.

Installing with conda#

We provide conda packages for qibo through the conda-forge channel.

To install the package with conda run:

conda install -c conda-forge qibo

Installing from source#

The installation procedure presented in this section is useful when you have to develop the code from source.

In order to install Qibo from source, you can simply clone the GitHub repository with

git clone https://github.com/qiboteam/qibo.git
cd qibo
pip install .

qibojit#

The qibojit package contains a simulator implementation based on just-in-time (JIT) custom kernels using numba and cupy. We also provide another implementation based on cuQuantum primitives available when running Qibo on GPU.

This backend is used by default, however, if needed, in order to switch to the qibojit backend please do:

import qibo
qibo.set_backend("qibojit")

Custom cupy kernels will be used by default if a GPU is available and custom numba kernels if a GPU is not available. If a GPU is available it is possible to switch to the cuQuantum implementation using the platform argument, for example:

import qibo
# switch to the cuquantum implementation
qibo.set_backend("qibojit", platform="cuquantum")
# switch to custom numba kernels (even if a GPU is available)
qibo.set_backend("qibojit", platform="numba")

Installing with pip#

The installation using pip is the recommended approach to install qibojit.

In order to install the package use the following command:

pip install qibojit

Note

The pip program will download and install all the required dependencies except cupy and/or cuQuantum which are required for GPU acceleration. The cuQuantum dependency is optional, as it is required only for the cuquantum platform. Please install cupy by following the instructions from the official website for your GPU hardware. The installation instructions for cuQuantum are available in the official documentation. qibojit is compatible with cuQuantum SDK v22.03 and cuQuantum SDK v22.05.

Installing with conda#

We provide conda packages for qibo and qibojit through the conda-forge channel.

To install both packages with conda run:

conda install -c conda-forge qibojit

Note

The conda program will download and install all the required dependencies except cupy and/or cuQuantum which are required for GPU acceleration. The cuQuantum dependency is optional, as it is required only for the cuquantum platform. Please install cupy by following the instructions from the official website for your GPU hardware. The installation instructions for cuQuantum are available in the official documentation. qibojit is compatible with cuQuantum SDK v22.03 and cuQuantum SDK v22.05.

Installing from source#

The installation procedure presented in this section is useful if you have to develop the code from source.

In order to install the package perform the following steps:

git clone https://github.com/qiboteam/qibojit.git
cd qibojit

Then proceed with the qibojit installation using pip

pip install .

tensorflow#

If the TensorFlow package is installed Qibo will detect and provide to the user the possibility to use tensorflow backend.

This backend is used by default if qibojit is not installed, however, if needed, in order to switch to the tensorflow backend please do:

import qibo
qibo.set_backend("tensorflow")

In order to install the package, we recommend the installation using:

pip install qibo tensorflow

Note

TensorFlow can be installed following its documentation.


numpy#

The qibo base package is distributed with a lightweight quantum simulator shipped with the qibo base package. No extra packages are required.

This backend is used by default if qibojit or tensorflow are not installed, however, if needed, in order to switch to the numpy backend please do:

import qibo
qibo.set_backend("numpy")

pytorch#

If the PyTorch package is installed Qibo will detect and provide to the user the possibility to use pytorch backend.

In order to switch to the pytorch backend please do:

import qibo
qibo.set_backend("pytorch")

In order to install the package, we recommend the installation using:

pip install qibo torch