PennyLane-Lightning provides high-performance C++ quantum simulators that integrate as plugins with the PennyLane quantum machine learning library. The base package includes the `lightning.qubit` device for CPU-based state-vector simulation, with other specialized devices (GPU, Kokkos, Tensor, AMDGPU) available via separate installation packages. It is actively maintained with frequent, typically monthly or bi-monthly, releases.
pip install pennylane-lightningVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `lightning.qubit` device and use it within a PennyLane quantum circuit to compute an expectation value and its gradients. Ensure PennyLane is also installed.
Install the specific package for the desired device, e.g., `pip install pennylane-lightning-gpu`.
Ensure your Catalyst Runtime version (e.g., v0.11.0 for PennyLane-Lightning v0.41.1) is compatible when using Lightning devices within Catalyst. Refer to the release notes for specific version requirements.
Consult the PennyLane-Lightning documentation for detailed hardware, driver, and CUDA/ROCm toolkit installation instructions before attempting to use these devices.
For very large numbers of qubits, consider using tensor network simulators (`lightning.tensor`), or sampling-based approaches, or distributed computing solutions (e.g., `lightning.kokkos` with MPI).
For optimal MCM performance and full feature set, ensure you are using a recent version (0.43.0+) and explicitly specify the `mcm_method` if required, e.g., `qml.device("lightning.qubit", wires=4, mcm_method="device")`.Ensure you are using a Python version supported by PennyLane-Lightning (e.g., 3.10 or newer) and that your system's `glibc` library is sufficiently new (e.g., 2.28 or greater for `manylinux_2_28` wheels). Using a virtual environment (like Conda or `venv`) is recommended. If problems persist, consider using cloud environments like Google Colab or qBraid, or compiling PennyLane-Lightning from source if you have specific system constraints.
Install the appropriate `custatevec` package for your CUDA version (e.g., `pip install custatevec-cu11` for CUDA 11.x or `custatevec-cu12` for CUDA 12.x). Verify that your NVIDIA CUDA Toolkit is correctly installed and configured, your NVIDIA drivers are up to date, and your GPU meets the minimum compute capability requirement (SM7.0 or newer).
Ensure your CUDA Toolkit is at a supported version (e.g., 11.5 or newer, 11.8 preferred, or 12.x for recent `pennylane-lightning` versions). Update your NVIDIA drivers and CUDA SDK if necessary. Crucially, ensure that the `LD_LIBRARY_PATH` environment variable includes the directory where your CUDA runtime libraries (e.g., `libcudart.so`) are located.
Ensure both `pennylane` and `pennylane-lightning` are installed from a compatible release, preferably by upgrading both simultaneously using `pip install pennylane pennylane-lightning --upgrade`. If you are building from source, clone and install `pennylane` from a compatible branch or version before installing `pennylane-lightning`.