Installation and dependencies¶
Dependencies¶
PennyLane requires the following libraries be installed:
Python >= 3.7
The following Python packages are hard dependencies, and will automatically be installed alongside PennyLane:
numpy >= 1.13.3
scipy >= 1.0.0
NetworkX >= 1.0.0
semantic-version >= 2.7
The following Python packages are optional:
dask[“parallel”], for parallel QNodeCollection execution
tensornetwork >= 0.3, for the
default.tensor
pluginopenfermionpyscf, for the non-differentiable backend of the
qml.qchem
module
If you currently do not have Python 3 installed, we recommend Anaconda for Python 3, a distributed version of Python packaged for scientific computation.
Interface dependencies¶
For development of the TensorFlow, PyTorch, and JAX interfaces, there are additional requirements which must be installed manually:
JAX interface:
jax > 0.2.0
andjaxlib
PyTorch interface:
pytorch >= 1.1
TensorFlow interface:
tensorflow >= 2.3
Installation¶
For development purposes, it is recommended to install PennyLane source code using development mode:
git clone https://github.com/PennyLaneAI/pennylane
cd pennylane
pip install -e .
The -e
flag ensures that edits to the source code will be reflected when
importing PennyLane in Python.
Note
Due to the use of entry points to install
plugins, changes to PennyLane device class locations or shortnames
requires pip install -e .
to be re-run in the plugin repository
for the changes to take effect.
Docker¶
Build a PennyLane Docker image¶
Docker support exists for building using CPU and GPU (Nvidia CUDA 11.1+) images.
Note
Docker builds using “make” will work on Linux and MacOS only. For MS Windows you can use WSL. They are currently not supported on the Apple M1 chip (ARM64).
Build a basic PennyLane image¶
To build a basic PennyLane image without any additional interfaces (Torch, TensorFlow, or Jax) or plugins (qiskit, amazon-braket, cirq, forest), run the following:
make -f docker/Makefile build-base
Build a PennyLane image with a specific interface¶
To build a PennyLane image using a specific interface (Torch, TensorFlow or Jax), run the following:
make -f docker/Makefile build-interface interface-name=tensorflow
To build a PennyLane image using a specific interface (Torch, TensorFlow or Jax) with GPU support, run the following:
make -f docker/Makefile build-interface-gpu interface-name=tensorflow
Build a PennyLane image with a plugin¶
To build a PennyLane image using a specific plugin (qiskit, amazon-braket, cirq, forest, etc), run the following:
make -f docker/Makefile build-plugin plugin-name=qiskit