windows安装pyG
前情提要
anaconda安装包遇到“无法定位程序输入点于……动态链接库”问题解决方案
首次安装的pyG出现问题,因此选择下面的重新安装流程,安装成功,没有再次报错。
安装anaconda
记得勾选添加环境变量
创建环境
首先判断一下所要安装的pytorch需要什么版本的python
conda create -n pyGtorch19 python=3.9
安装pytorch
进入主页后,
https://pytorch.org/get-started/locally/
点击previous pytorch versions,然后找v2.0.0的pip安装
pip install torch==2.0.0+cpu torchvision==0.15.1+cpu torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cpu
测试版本
import pytorch
print(torch.__version__)
安装对应版本的pyG
https://pytorch-geometric.readthedocs.io/en/stable/install/installation.html
先安装下方的依赖,然后安装pyg
pip install torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.0.0+cpu.html
pip install torch_geometric
代码测试
安装jupyter kernel
pip install ipykernel
python -m ipykernel install --user --name pygtorch22
from torch_geometric.datasets import Planetoid
dataset = Planetoid(root='/tmp/Cora', name='Cora')
print('len(dataset):{}'.format(len(dataset)))
print('dataset.num_classes:{}'.format(dataset.num_classes))
print('dataset.num_node_features:{}'.format(dataset.num_classes))
len(dataset):1
dataset.num_classes:7
dataset.num_node_features:7
注意,如果数据下载不下来,“科学开全局模式”可以解决。
linux服务器安装pyg
conda拷贝contextaqaGPU环境
参考https://pytorch-geometric.readthedocs.io/en/stable/install/installation.html
先安装依赖,再安装pyg
运行training.py报错
没有Glibc-2.29
所以参考下述连接进行安装:
https://stackoverflow.com/questions/74740941/how-can-i-resolve-this-issue-libm-so-6-version-glibc-2-29-not-found-c-c
安装过程中报错:
*** These critical programs are missing or too old: gawk bison *** Check the INSTALL file for required versions.
解决失败,随记录,后期换集群设备的ubuntu 20.04系统解决。
ubuntu 20.04安装pyg
conda create -n pyg python==3.9
https://pytorch.org/get-started/previous-versions/
安装pytorch2.2.1
pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu121
安装pyg
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.2.0+cu121.html
pip install torch_geometric