直接使用pip安装torch_sparse,出现错误。
pip install torch_sparse
ERROR: Failed building wheel for torch_sparse
Running setup.py clean for torch_sparse
Failed to build torch_sparse
ERROR: Could not build wheels for torch_sparse, which is required to install pyproject.toml-based projects
1.查看本机的pytorch版本
>>> import torch
>>> torch.__version__
'1.12.1'
2.在https://pytorch-geometric.com/whl/选择匹配的版本。
3.点进去复制网址https://pytorch-geometric.com/whl/torch-1.12.1+cu116.html,就可以安装好了。torch_scatter也适用。
pip install torch_sparse==0.6.14 -f https://pytorch-geometric.com/whl/torch-1.12.1+cu116.html
pip install torch_scatter==2.1.0 -f https://pytorch-geometric.com/whl/torch-1.12.1+cu116.html