PennyLane

A framework for differentiable quantum programming that connects quantum circuits to PyTorch, JAX and TensorFlow and works with many hardware backends and simulators.

ActiveMediumv0.45.1Apache-2.0Quantum Machine Learning

Official documentationTry the examples

Basic information

NamePennyLane
Full namePennyLane
CategoryQuantum Machine Learning
DeveloperXanadu (the company)
Release year2018
Official websitegithub.com/PennyLaneAI/pennylane
GitHub repositoryPennyLaneAI/pennylane
Official documentationNot specified
Package on PyPIpennylane
LicenseApache-2.0 (PyPI license_expression)
Project statusActive Had a release in the last 12 months
Latest version26 June 2026 (version 0.45.1)
Programming languagePython
Operating systemsLinux, MacOS X, POSIX, Windows (as declared by the package on PyPI)
Required Python version>=3.11
Difficulty levelMedium

Data last checked: 21 November 2026 — source: PyPI JSON API (2026-11-21)

Overview

In PennyLane the user defines quantum nodes (QNode) that are differentiated automatically, so circuits enter hybrid models and are optimised with classical framework optimizers, with plugins to connect to hardware and simulators from various providers.

It stands out for a rich library of tutorials on quantum machine learning and quantum chemistry.

When to choose it? Choose it for differentiable quantum machine learning with classical frameworks.

Uses

Main uses

  • Differentiable variational circuits
  • Hybrid quantum-classical models
  • Teaching quantum computing

Scientific fields

  • Quantum computing
  • Quantum chemistry

Suitable project types

  • A hybrid quantum classifier with PyTorch

Research applications

  • Experiments with variational circuits and the barren plateau problem

Quantum Machine Learning

Technical features

A feature is shown as "Supported" only if it is documented in the library's official documentation; anything we have not verified is shown as "Not specified".

CPU supportSupported
GPU supportPartial or through an add-onThrough simulators such as lightning.gpu.
CUDA compatibilityPartial or through an add-on
Distributed training or computingNot supported
Automatic differentiation (Autodiff)SupportedWith PyTorch, JAX and TensorFlow.
Model deploymentNot applicable
Pre-trained modelsNot applicable
Supported data typesQuantum circuits
Integration with other librariesPyTorch, JAX, TensorFlow, Qiskit Machine Learning
Flexibility (editorial estimate)High
Performance (editorial estimate)Depends on the simulator
Community (editorial estimate)Large in the field
Documentation quality (editorial estimate)Excellent tutorials

Installation and running

Shell
pip install pennylane

Compatibility: Python >=3.11 — according to the package data on PyPI, checked on 21 November 2026

Installing inside a virtual environment (venv or conda) is recommended. If you need compatibility with a specific CUDA version or operating system, refer to the official documentation, because this information changes with every release.

Code examples

Examples marked "Run and tested" were actually run, with their output, test date and library versions recorded; the others need a GPU or model downloads, so they were not run in the test environment.

MediumA differentiable variational circuit in PennyLaneRun and tested

Goal: Optimising the parameters of a quantum circuit by gradient.

Python — example.py
import pennylane as qml
from pennylane import numpy as np

dev = qml.device("default.qubit", wires=2)

@qml.qnode(dev)
def circuit(w):
    qml.RX(w[0], wires=0); qml.RY(w[1], wires=1)
    qml.CNOT(wires=[0, 1])
    return qml.expval(qml.PauliZ(1))

w = np.array([0.1, 0.2], requires_grad=True)
opt = qml.GradientDescentOptimizer(stepsize=0.4)
print(f"Before: {circuit(w):.4f} | gradient: {np.round(qml.grad(circuit)(w), 4)}")
for _ in range(40):
    w = opt.step(circuit, w)
print(f"After 40 steps: {circuit(w):.4f}")

Code explanation

We define a quantum node (QNode) on the default.qubit simulator and compute the expectation value of PauliZ. PennyLane computes the gradient with the parameter-shift rule, and we use an optimizer to drive the expectation value towards -1.

Requirements

Shell
pip install pennylane

How to run

Save the code in a file example.py then run it:

Shell
python example.py

Output recorded during testing

Before: 0.9752 | gradient: [-0.0978 -0.1977]
After 40 steps: -1.0000

This example was actually run and tested on 21 November 2026 on a CPU — pennylane 0.45.1, python 3.13.18

Example page

All PennyLane examples in the Code Explorer

Pros

  • Automatic differentiation of circuits
  • Hardware-independent
  • Excellent tutorials

Limitations

  • Simulation is expensive for large systems

References and verification

  • Package page on PyPI (source of the version, licence and release date) Checked directly

    https://pypi.org/project/pennylane/

    Checked on: 21 November 2026 — version checked: 0.45.1 — reviewed by: the DLArabic team

  • Official website A link the package officially declares on PyPI

    https://github.com/PennyLaneAI/pennylane

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official repository A link the package officially declares on PyPI

    https://github.com/PennyLaneAI/pennylane

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

History of verified versions

VersionRelease dateChecked on
0.45.126 June 202621 November 2026

Page information last reviewed: 21 November 2026. The description was written originally for the encyclopedia and is not copied from the official websites.

Report information that needs updating