Installation¶
Requirements¶
PyTorch Lightning requires:
Python 3.9 or later
PyTorch 2.0 or later
CUDA 11.8+ (optional, for GPU acceleration)
Install from PyPI¶
The recommended way to install PyTorch Lightning:
pip install lightning
This installs the unified lightning package which includes lightning.pytorch.
To install the standalone PyTorch Lightning package:
pip install pytorch-lightning
Install with extras¶
# Weights & Biases integration
pip install "lightning[wandb]"
# MLflow integration
pip install "lightning[mlflow]"
# All optional integrations
pip install "lightning[extra]"
Install from source¶
git clone https://github.com/Lightning-AI/pytorch-lightning.git
cd pytorch-lightning
pip install -e ".[dev]"
Verifying installation¶
import lightning as L
print(L.__version__) # 2.4.0
import lightning.pytorch as pl
print(pl.__version__) # 2.4.0
Docker¶
An official Docker image is available:
docker pull pytorchlightning/pytorch_lightning:base-cuda-py3.11-torch2.4
docker run --gpus all -it pytorchlightning/pytorch_lightning:base-cuda-py3.11-torch2.4
Note
When using Docker with GPU support, ensure the NVIDIA Container Toolkit is installed on the host machine.