pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu116

Ubuntu20安装torch1.13和pytorch_geometric2.3.0(对应cuda11.6)-LMLPHP

  • 安装torch2.3.0 https://pytorch-geometric.readthedocs.io/en/2.3.0/install/installation.html,我的python版本3.8符合,pytorch1.13.0,cuda11.6
    Ubuntu20安装torch1.13和pytorch_geometric2.3.0(对应cuda11.6)-LMLPHP
  • 首先安装对应库,参考官方版本
    pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-1.13.0+cu116.html
  • 有个小问题,安装到torch_cluster就不动了,一直在Building wheel for torch_cluster (setup.py) …打转,选择手动安装,在这下载对应包https://data.pyg.org/whl/torch-1.13.0+cu116.html,搜索torch_cluster,选择cp38我是python38复制对应链接
    wget https://data.pyg.org/whl/torch-1.13.0%2Bcu116/torch_cluster-1.6.0%2Bpt113cu116-cp38-cp38-linux_x86_64.whl
    pip install torch_cluster-1.6.0+pt113cu116-cp38-cp38-linux_x86_64.whl
    Ubuntu20安装torch1.13和pytorch_geometric2.3.0(对应cuda11.6)-LMLPHP
  • 可能之前依赖问题,运行时候出错UserWarning: An issue occurred while importing ‘pyg-lib’. 可以卸载再重新安装,推荐还是一个库一个库安装
    pip install pyg_lib -f https://data.pyg.org/whl/torch-1.13.0+cu116.html
  • 指定版本号安装torch_geometric==2.3.0
    pip install torch_geometric==2.3.0 -f https://data.pyg.org/whl/torch-1.13.0+cu116.html
  • 起因:之前版本是torch_geometric2.0.4,使用GAT报错ImportError: cannot import name ‘DenseGATConv’ from ‘torch_geometric.nn’,查了一下文档在2.3.0才引入这个函数https://readthedocs.org/projects/pytorch-geometric/,还得把nvidia-smi升级到535
    Ubuntu20安装torch1.13和pytorch_geometric2.3.0(对应cuda11.6)-LMLPHP
05-05 07:35