torch-geometric的安装问题记录
一、GPU版
我的版本: cuda10.2 – torch1.7.1
1. 问题
最后总有一句:Check the logs for full command output.
2. 解决方法(选择兼容的版本)
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.7.1+cu102.html
pip install torch-cluster -f https://data.pyg.org/whl/torch-1.7.1+cu102.html
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.7.1+cu102.html
pip install torch-geometric
若是还有问题,可尝试降低版本,最终版本如下图所示(直接安装以下版本亦可):
3. 参考博文
- https://blog.csdn.net/weixin_44179715/article/details/122456343 (pytorch geometric安装记录)
- https://blog.csdn.net/baidu_20163013/article/details/105470332 (torch-sparse gcc编译失败分析)
4. 修改源码记录
我在windows上使用,源码中的files.exist并不符合我的预期,可能哪里还有点问题,修改前后图如下:
最后可以跑通,但是由于其它问题放弃GPU版本
由于一些问题又再另一台电脑上安装GPU版本(20220314更新)
5. 文件名或扩展名太长(20220314更新)
- https://blog.csdn.net/weixin_43148691/article/details/117354062 (python在使用pip过程中出现的路径过长问题)
6. error: member “torch::jit::ProfileOptionalOp::Kind“ may not be initialized
- https://blog.csdn.net/qq_40714949/article/details/115654215 (注释掉相关代码)
7. 其它一些编译的c++错误(感觉不对劲,像是版本不兼容)
vs2019 – torch1.7.1 – cuda10.2 – 相应版本的torch-cluster 等等(出现莫名错误)
后续升级
vs2019 – torch1.8.0 – cuda10.2 – 相应版本的 torch-cluster 等等 正常安装
猜测可能编译器有关
8. 跑别人代码,然后torch-geometric 报一些未实现的错误(具体错误忘记了)
这里我只是想说… 这个高版本不一定兼容低版本 跑别人代码记得对应版本(差距别太大 - -)
二、只是测试,建议使用CPU版(方便)
版本如下(其它兼容版本亦可):
出现问题:cannot import name ‘SparseTensor’ from ‘torch_sparse’ 也是由于版本不匹配
python3.7 pytorch1.7.1(cpu) 完全按照以上版本安装 亲测正常