GNN Environment Configuration

Should be careful when doing Configuration. Different versions of Compiliers do not play nice with each other…

Generally, NEVER use pip install something !!! This may lead to fatal result on your environment.

You have to specify which verison of something you intend to install.

From 0 to 100

Here is a stable version of Graph Research Environment provided by Dr. Xiaohang Zhao. This by no means is the latest version.

conda create --name GNN python=3.8.10
conda activate GNN
conda install tqdm ipykernel=5.3.4 numpy=1.20.2 numba pandas=1.2.4 scikit-learn=0.24.2 scikit-learn-intelex
# there will be a message saying that to run scripts with accelerated scikit-learn, using
# python -m sklearnex my_application.py
python -m ipykernel install --user --name=GNN
conda install -c conda-forge ipywidgets
jupyter nbextension enable --py widgetsnbextension
# jupyter contrib nbextension install --user

# install pytorch the lastest version is 1.9
conda install pytorch=1.8.0 torchvision torchaudio cudatoolkit=10.2 -c pytorch


# install PyTorch geometric
pip install torch-scatter==2.0.7 -f https://pytorch-geometric.com/whl/torch-1.8.0+cu102.html
pip install torch-sparse==0.6.9 -f https://pytorch-geometric.com/whl/torch-1.8.0+cu102.html
pip install torch-cluster==1.5.9 -f https://pytorch-geometric.com/whl/torch-1.8.0+cu102.html
pip install torch-spline-conv==1.2.1 -f https://pytorch-geometric.com/whl/torch-1.8.0+cu102.html
pip install torch-geometric==1.7.0

# install DGL
conda install -c dglteam dgl-cuda10.2
python -m dgl.backend.set_default_backend pytorch

# install other useful packages
pip install torch-geometric-temporal==0.37
pip install deepsnap==0.2.0
pip install captum==0.3.1


# remove the environment
conda deactivate
conda remove --name GNN --all 
jupyter kernelspec uninstall gnn
# remove all the caches created by conda
conda clean --all

Here is another choice provided by Jiaxuan You:

# Python environment (Optional)
conda create -n envname python=3.7
source activate envname

# Pytorch
# CUDA versions: cpu, cu92, cu101, cu102, cu101, cu111
pip install torch==1.8.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

# Pytorch Geometric
# CUDA versions: cpu, cu92, cu101, cu102, cu101, cu111
# TORCH versions: 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0
CUDA=cu101
TORCH=1.8.0
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



from 50 to 100

Basically, you have to pre-check the version of (if you already directly use pip install xxx to install the following module):

  • Pytorch
  • Nvidia CUDA Compiler (NVCC)
  • Nvidia GPU Driver
  • Pytorch Geometric

check torch version:

conda activate GNN
python3
import torch
print(torch.__version__)
exit()

check CUDA Compiler Version:

nvcc

check Nvidia GPU Driver Version:

nvidia-smi

For more detail, check out Pytorch Docs

Common Issues

Related