其他必备的包可以和torch_geometric 一起安装:
pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.9.0+cu102.html
将pytorch和cuda版本替换成自己的版本就好。
如果之前没有安装过这些包,应该很顺利就装好了。
但如果像我一样,在pycharm里面单独安装的这些包,即使和正确的版本是一致的,也有可能出问题
pycharm装好这些包之后,我尝试再pip安装一下,结果看似完美:
Requirement already satisfied: torch-scatter in
/home/xx/anaconda3/lib/python3.8/site-packages (2.0.9)
Requirement already satisfied: torch-sparse in
/home/xx/anaconda3/lib/python3.8/site-packages (0.6.12)
Requirement already satisfied: torch-cluster in
/home/xx/anaconda3/lib/python3.8/site-packages (1.5.9)
Requirement already satisfied: torch-spline-conv in
/home/xx/anaconda3/lib/python3.8/site-packages (1.2.1)
Requirement already satisfied: torch-geometric in
/home/xx/anaconda3/lib/python3.8/site-packages (2.0.0)
.
.
.
.
.
但运行 import torch_geometric 都过不去:
解决的问题就是torch_sparse出现问题,那就 uninstall 再 install ,问题就解决了,至少import 不会出问题了,后续的坑慢慢再填。。。
import ogb
from ogb.graphproppred import PygGraphPropPredDataset
import torch_geometric
from torch_geometric.data import DataLoader
if __name__ == '__main__':
print(ogb.__version__)
print(torch_geometric.__version__)
Using backend: pytorch
1.3.2
2.0.0