欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ModuleNotFoundError: No module named ‘torch_sparse‘

程序员文章站 2022-05-28 22:27:29
...

https://github.com/rusty1s/pytorch_sparse

1、
You can now install pytorch-sparse via Anaconda for all major OS/PyTorch/CUDA combinations ???? Given that you have pytorch >= 1.8.0 installed, simply run

conda install pytorch-sparse -c pyg

2、
PyTorch 1.10.0
To install the binaries for PyTorch 1.10.0, simply run

pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+${CUDA}.html

where ${CUDA} should be replaced by either cpu, cu102, or cu113 depending on your PyTorch installation.

我用的第二种方法,我的cuda是11.5,命令如下:

pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+cu113.html

查看pytorch版本:
import torch
print(torch.version) #注意是双下划线