Installation and dependencies

Dependencies

PennyLane requires the following libraries be installed:

The following Python packages are hard dependencies, and will automatically be installed alongside PennyLane:

The following Python packages are optional:

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 and jaxlib <= 0.4.28

  • PyTorch interface: pytorch

  • TensorFlow interface: tensorflow < 2.17

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.

Apart from the core packages needed to run PennyLane, some extra packages need to be installed for several development processes, such as linting, testing, and pre-commit quality checks. Those can be installed easily via pip:

pip install -r requirements-dev.txt