问题描述
在安装torch_scatter和torch_sparse包时,如果直接使用pip install torch_scatter
和pip install torch_sparse
,可能会遇到如下错误:
Error: Command errored out with exist status 1:
解决方法
解决方法是可以手动安装,即手动从官网下载.whl包然后再pip安装。
首先查看自己的pytorch版本:
pip list
以及cuda版本(如果有GPU的话):
nvidia-smi
然后就可以上官网下载对应版本的.whl安装包了。
首先选择对应的pytorch及cpu或cuda版本:
然后根据自己的python版本(cp)及操作系统选择安装包下载:
下载好后,将命令行工作目录cd到安装包所在的目录,然后pip install + .whl文件名即可,例如:
pip install torch_scatter-2.0.9-cp38-cp38-linux_x86_64.whl
pip install torch_sparse-0.6.12-cp38-cp38-linux_x86_64.whl
安装完毕!