Creating and configuring a environment with Pytorch Geometric (PyG) - SPRACE/track-ml GitHub Wiki
This instruction works with:
- Python 3.8
- Pytorch 1.8.1
- Pytorch Geometric 1.7.0
- Pytorch Lightning 1.3.0
Stack installation
Environment
At first, we need to create a conda environment with python 3.8 because, actually, Pytorch Geometric doesn't works property with the latest python version.
conda create -n your_env_name python=3.8
conda activate your_env_name
Pytorch
Here we have the instructions to install the pytorch for your environment's configurations.
To exemplify, we will install the latest Pytorch stable version (1.8.1) for python3.8, CUDA 10.2 using conda
:
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
Pytorch Geometric
After Pytorch installation, we will install Pytorch Geometric and some dependencies:
Check this link to choose the best option for your environment.
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-geometric
where ${CUDA}
and ${TORCH}
should be replaced by your specific CUDA version (cpu, cu92, cu101, cu102, cu110, cu111) and PyTorch version (1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0)
In our case:
export TORCH=1.8.1
export CUDA=cu102
Pytorch Lightning
To install Pytorch Lightning:
You can install using pip
pip install pytorch-lightning
Or with conda (see how to install conda here):
conda install pytorch-lightning -c conda-forge