ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

No module named torch_sparse, 及pytorch-geometric安装

2021-11-02 20:58:54  阅读:342  来源: 互联网

标签:named No whl torch pytorch install pip geometric


pip安装完pytorch-geometric之后,报错No module named torch_sparse,搜了一下,居然是一个大坑,总结一下。网上各种方法都装不上,总是出各种问题,最后还是在官网上面找到安装方法。下面记载一下:

第一种方法(别人我不知道,我试着无效):

 第二种方法(亲测有效):

We alternatively provide pip wheels for all major OS/PyTorch/CUDA combinations, see here

网址为:https://data.pyg.org/whl 链接过去后显示如图

 然后根据pytorch和cuda版本选择所需要的whl文件,比如我的pytorch=1.9.0,cuda为10.2,所以我选择torch-1.9.0+cu102,链接过去得到下图,根据自己的python版本选择对应的whl文件就可以了,因为我的python版本是3.6的,所以选择了torch_cluster-1.5.9-cp36-cp36m-linux_x86_64.whltorch_scatter-2.0.7-cp36-cp36m-linux_x86_64.whl   和 torch_sparse-0.6.10-cp36-cp36m-linux_x86_64.whl

 注意:这几个whl文件可能也和顺序有关,要先安装torch_cluster和torch_scatter之后再安装torch_sparse,最后安装torch_geometric。

第三种方法(别人说可行,我测试着也不可行):

$ 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

标签:named,No,whl,torch,pytorch,install,pip,geometric
来源: https://blog.csdn.net/anshiquanshu/article/details/121108268

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有