{"id":3736,"library":"pennylane-lightning","title":"PennyLane-Lightning","description":"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.","status":"active","version":"0.44.0","language":"en","source_language":"en","source_url":"https://github.com/PennyLaneAI/pennylane-lightning","tags":["quantum computing","simulator","pennylane","qubit","gpu","high-performance","quantum machine learning"],"install":[{"cmd":"pip install pennylane-lightning","lang":"bash","label":"Base package (lightning.qubit)"}],"dependencies":[{"reason":"Core library; PennyLane-Lightning provides devices for PennyLane.","package":"pennylane","optional":false},{"reason":"Numerical operations and array handling.","package":"numpy","optional":false}],"imports":[{"note":"PennyLane-Lightning devices are loaded via `qml.device` using their string name, not by direct import of a class from the `pennylane_lightning` package itself. Attempting direct import will fail.","wrong":"from pennylane_lightning import LightningQubit","symbol":"qml.device","correct":"import pennylane as qml\ndevice = qml.device(\"lightning.qubit\", wires=4)"}],"quickstart":{"code":"import pennylane as qml\nimport numpy as np\n\n# Create a Lightning Qubit device\ndev = qml.device(\"lightning.qubit\", wires=2)\n\n@qml.qnode(dev)\ndef circuit(x):\n    qml.RX(x[0], wires=0)\n    qml.RY(x[1], wires=1)\n    qml.CNOT(wires=[0, 1])\n    return qml.expval(qml.PauliZ(0))\n\n# Run the circuit\nparams = np.array([0.54, 0.12], requires_grad=True)\nresult = circuit(params)\nprint(f\"Expectation value: {result}\")\n\n# Calculate gradients\ndq = qml.grad(circuit)(params)\nprint(f\"Gradients: {dq}\")","lang":"python","description":"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."},"warnings":[{"fix":"Install the specific package for the desired device, e.g., `pip install pennylane-lightning-gpu`.","message":"The `pennylane-lightning` package only provides the `lightning.qubit` CPU device. For GPU-accelerated (`lightning.gpu`), Kokkos-enabled (`lightning.kokkos`), Tensor Network (`lightning.tensor`), or AMDGPU (`lightning.amdgpu`) devices, separate `pennylane-lightning-gpu`, `pennylane-lightning-kokkos`, `pennylane-lightning-tensor`, and `pennylane-lightning-amdgpu` packages must be installed respectively.","severity":"gotcha","affected_versions":"All versions"},{"fix":"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.","message":"Building Catalyst Lightning plugins requires compatibility with specific Catalyst Runtime versions.","severity":"breaking","affected_versions":"0.41.1 onwards"},{"fix":"Consult the PennyLane-Lightning documentation for detailed hardware, driver, and CUDA/ROCm toolkit installation instructions before attempting to use these devices.","message":"Specialized devices like `lightning.gpu`, `lightning.kokkos`, and `lightning.amdgpu` have specific hardware and driver requirements (e.g., NVIDIA CUDA, AMD ROCm). They will not function without the correct setup.","severity":"gotcha","affected_versions":"All versions supporting these devices"},{"fix":"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).","message":"Like all state-vector simulators, `lightning.qubit`'s memory consumption scales exponentially with the number of qubits. This can quickly become a bottleneck for circuits with a large number of wires.","severity":"gotcha","affected_versions":"All versions"},{"fix":"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\")`.","message":"Support for mid-circuit measurements (MCMs) and their different execution methods (`mcm_method`) was introduced and refined, potentially impacting performance or available features.","severity":"gotcha","affected_versions":"Prior to 0.43.0 for full support, 0.43.0 introduced `mcm_method=\"device\"` and `\"tree-traversal\"`"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}