cuda 9.0 安装torch 0.4_No module named torch_sparse, 及pytorch-geometric安装
pip安装完pytorch-geometric之后,报错No module named torch_sparse,搜了一下,居然是一个大坑,总结一下先上踩坑前辈:踩坑总结:No module named torch_sparseblog.csdn.net安装PyTorch-Geometric包之Installation PyG踩坑汇总= =blog.csdn.netPyTorch Geomet
pip安装完pytorch-geometric之后,报错No module named torch_sparse,搜了一下,居然是一个大坑,总结一下
先上踩坑前辈:
踩坑总结:No module named torch_sparseblog.csdn.net
小结:这个包就是个坑货(o(╥﹏╥)o)
下面两种方法实测都可以用,第二种更方面
1.下面是我安装的过程:
wget https://pytorch-geometric.com/whl/torch-1.5.0/torch_scatter-2.0.5%2Bcpu-cp37-cp37m-linux_x86_64.whl
pip install torch_scatter-2.0.5+cpu-cp37-cp37m-linux_x86_64.whl
wget https://pytorch-geometric.com/whl/torch-1.5.0/torch_sparse-0.6.6%2Bcpu-cp37-cp37m-linux_x86_64.whl
pip install torch_sparse-0.6.6+cpu-cp37-cp37m-linux_x86_64.whl
wget https://pytorch-geometric.com/whl/torch-1.5.0/torch_cluster-1.5.6%2Bcpu-cp37-cp37m-linux_x86_64.whl
pip install torch_cluster-1.5.6+cpu-cp37-cp37m-linux_x86_64.whl
wget https://pytorch-geometric.com/whl/torch-1.5.0/torch_spline_conv-1.2.0%2Bcpu-cp37-cp37m-linux_x86_64.whl
pip install torch_spline_conv-1.2.0+cpu-cp37-cp37m-linux_x86_64.whl
pip install torch-geometric
参考了第一篇文章,直接下载对应的编译文件,注意要对应好你自己的python版本以及及其环境,我的是python3.7, ubuntu。
可以从这个网址找对应的whl文件:https://pytorch-geometric.com/whl/torch-1.5.0.html
2.官网还有个教程,也是能用的。
$ pip install torch-scatter==latest+${CUDA} -f https://pytorch-geometric.com/whl/torch-${TORCH}.html
$ pip install torch-sparse==latest+${CUDA} -f https://pytorch-geometric.com/whl/torch-${TORCH}.html
$ pip install torch-cluster==latest+${CUDA} -f https://pytorch-geometric.com/whl/torch-${TORCH}.html
$ pip install torch-spline-conv==latest+${CUDA} -f https://pytorch-geometric.com/whl/torch-${TORCH}.html
$ pip install torch-geometric
where${CUDA}and${TORCH}should be replaced by your specific CUDA version (cpu,cu92,cu101,cu102) and PyTorch version (1.4.0,1.5.0), respectively. For example, for PyTorch 1.5.0/1.5.1 and CUDA 10.2
根据个人电脑配置,选择相应的选项。
例如:
$ pip install torch-scatter==latest+cpu -f https://pytorch-geometric.com/whl/torch-1.5.0.html
$ pip install torch-sparse==latest+cpu -f https://pytorch-geometric.com/whl/torch-1.5.0.html
$ pip install torch-cluster==latest+cpu -f https://pytorch-geometric.com/whl/torch-1.5.0.html
$ pip install torch-spline-conv==latest+cpu -f https://pytorch-geometric.com/whl/torch-1.5.0.html
$ pip install torch-geometric
另外的另外:
如果报错:libtorch_cpu.so: cannot open shared object file: No such file or directory,
那么,你的pytorch可能版本太低了,需要更新到torch1.5.0或者1.5.1。
至此,完美解决
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)