"OGB" OSError: [WinError 127] 找不到指定的程序。
- 2.[OGB使用环境安装与依赖](https://ogb.stanford.edu/docs/home/)
- 3.[torch-geometric 环境安装->(点击即官网链接)](https://pytorch-geometric.com/whl/)
1.遇到这类问题往往跟torch安装的工具包(如torch-sparse,torch-scatter,torch-cluster)版本没对应上有关
-
2.OGB使用环境安装与依赖
- You can install OGB using Python package manager pip.
pip install ogb
Please check the version is 1.3.1.
python -c "import ogb; print(ogb.__version__)"
# Otherwise, please update the version by running
pip install -U ogb
- Requirements
-
Data Loaders
from ogb.graphproppred import PygGraphPropPredDataset
from torch_geometric.data import DataLoader
# Download and process data at './dataset/ogbg_molhiv/'
dataset = PygGraphPropPredDataset(name = "ogbg-molhiv", root = 'dataset/')
split_idx = dataset.get_idx_split()
train_loader = DataLoader(dataset[split_idx["train"]], batch_size=32, shuffle=True)
valid_loader = DataLoader(dataset[split_idx["valid"]], batch_size=32, shuffle=False)
test_loader = DataLoader(dataset[split_idx["test"]], batch_size=32, shuffle=False)
3.torch-geometric 环境安装->(点击即官网链接)
如果装的是cu10.0,只能用torch1.4之前的低版本了。torch版本太高了会报错
- 查询torch里面用的cuda版本
nvcc --version
python -c 'import torch; print(torch.__version__)'
python -c 'import torch; print(torch.version.cuda)'
-
安装torch-geometric 四件套
pip install torch-sparse
pip install torch-scatter
pip install torch-cluster
pip install torch-geometric
pip install torch-spline-conv(optional)
指定网址安装
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.4.0+cu100.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.4.0+cu100.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.4.0+cu100.html
pip install torch-geometric
离线下载whl,本地安装
wget https://xxx.whl
wget https://pytorch-geometric.com/whl/torch-1.4.0+cu100/torch_cluster-1.5.4-cp37-cp37m-linux_x86_64.whl
wget https://pytorch-geometric.com/whl/torch-1.4.0+cu100/torch_scatter-2.0.4-cp37-cp37m-linux_x86_64.whl
wget https://pytorch-geometric.com/whl/torch-1.4.0+cu100/torch_sparse-0.6.1-cp37-cp37m-linux_x86_64.whl
pip install <whl-name>.whl
pip install torch-geometric
降格使用
卸载当前冲突包
pip uninstall torch-scatter
pip uninstall torch-sparse
pip uninstall torch-cluster
pip uninstall torch-spline-conv
pip uninstall torch-geometric
安装其他版本
跑geometric的开源项目,经常离不开ogb数据包。截止21.04最新的ogb包是1.3.1版本的。
-
测试
python -c "import torch_geometric"
如果没报错,就成功了。