PennyLane is a cross-platform Python library for differentiable programming of quantum computers, quantum machine learning, and quantum chemistry. It enables users to build, optimize, and deploy hybrid quantum-classical applications by seamlessly integrating with popular machine learning frameworks like NumPy, PyTorch, TensorFlow, and JAX. The library is under active development, with new versions and features released every few months, aiming to make quantum computing accessible for research and application development.
pip install pennylaneVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a quantum device, create a quantum circuit (QNode) with parameters, execute it, and compute gradients using PennyLane's automatic differentiation capabilities. This is a fundamental workflow for variational quantum algorithms.
Upgrade your NumPy installation to version 2.0 or newer: `pip install "numpy>=2.0"`.
If on MacOS, migrate to an ARM-based Mac or build x86 wheels manually if absolutely necessary. Ensure your Python environment is 3.11 or newer.
Refactor custom decomposition logic to use the new graph-based decomposition system and `qml.decomposition` module.
Update code to use `operator.is_verified_hermitian` property or call the `qml.is_hermitian(operator)` function for a more comprehensive check.
Change any instances of `level=None` to `level='device'` when calling these introspection and workflow functions.
Install the required PennyLane plugin for the device (e.g., `pip install pennylane-qiskit` for Qiskit devices, `pip install pennylane-qulacs` for Qulacs). If in a notebook environment like Google Colab, ensure you restart the runtime after installation.
Upgrade PennyLane to the latest version using `pip install --upgrade pennylane`. If the issue persists, consult the PennyLane release notes or documentation for specific API changes related to the attribute or module in question.
Install the `quimb` library by running `pip install quimb` in your terminal or command prompt.
Reduce the number of qubits in your circuit when using `default.mixed`. For larger qubit counts, consider using a state-vector simulator like `default.qubit` or `lightning.qubit`, which are more memory-efficient for pure state simulations, or explore advanced techniques like circuit cutting for very large systems.