Pytorch Geometric Environment

本地 GPU 配 pytorch_geometric 被 GCC version 坑过一次了,这次在系里服务器(NVIDIA Quadro RTX 8000)又从头搞了一次,这里记录一下,毕竟以后还要经常和 geometric 打交道(。


在虚拟环境下安装"torch_spase” 出现 GNU 版本不支持问题

/usr/local/cuda/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!
  138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!
      |  ^~~~~
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

查看 CUDA 和 gcc version

cat /usr/local/cuda/version.txt
CUDA Version 10.1.243

gcc -v
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)

As already pointed out, nvcc depends on gcc 8.0. It is possible to configure nvcc to use the correct version of gcc without passing any compiler parameters by adding softlinks to the bin directory created with the nvcc install.

网上给的 solution: basically adding a softlink to the correct version of gcc from this directory:

sudo ln -s /usr/bin/gcc-8.0 /usr/local/cuda/bin/gcc


pytorch 和 torch_spase 调用的 CUDA 版本不一致

安装 pytorch 1.6 时注意 CUDA 版本选 10.1,因为 torch_spase 只支持到 10.1

pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f

修正以后的各种 version

pytorch 1.6
CUDA Version 10.1.243
gcc version 8.4.0 (Ubuntu 8.4.0-3ubuntu2)

然后按照 torch-geometric 的文档安装其他相关 package 即可

pip install torch-scatter==latest+cu101 -f
pip install torch-sparse==latest+cu101 -f
pip install torch-cluster==latest+cu101 -f
pip install torch-spline-conv==latest+cu101 -f
pip install torch-geometric

参考资料 Pytorch 选安装版本 Installation torch-geometric via Binarie

Hejie Cui
Hejie Cui
PhD Student in CS

My research interests include information retrieval, machine learning and data mining.