报错信息
使用pip install torch-sparse
安装时报错。报错信息很长:
error: command '/usr/local/cuda-11.1/bin/nvcc' failed with exit status 1
error: subprocess-exited-with-error
× Running setup.py install for torch_sparse did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /home/qxwang/conda_envs/pygood/bin/python3.8 -u -c '
exec(compile('"'"''"'"''"'"'
# This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
#
# - It imports setuptools before invoking setup.py, to enable projects that directly
# import from `distutils.core` to work with newer packaging standards.
# - It provides a clear error message when setuptools is not installed.
# - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
# setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
# manifest_maker: standard file '"'"'-c'"'"' not found".
# - It generates a shim setup.py, for handling setup.cfg-only projects.
import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute `setup.py` since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)
__file__ = %r
sys.argv[0] = __file__
if os.path.exists(__file__):
filename = __file__
with tokenize.open(__file__) as f:
setup_py_code = f.read()
else:
filename = "<auto-generated setuptools caller>"
setup_py_code = "from setuptools import setup; setup()"
exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'/tmp/pip-install-_r0ouzvx/torch-sparse_3cbd6ef56d15485bbf2105ec8ba0705e/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' install --record /tmp/pip-record-xjr_dfii/install-record.txt --single-version-externally-managed --compile --install-headers /home/qxwang/conda_envs/pygood/include/python3.8/torch_sparse
cwd: /tmp/pip-install-_r0ouzvx/torch-sparse_3cbd6ef56d15485bbf2105ec8ba0705e/
Running setup.py install for torch_sparse ... error
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> torch_sparse
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
解决方法:
直接到torch-geometric官网下载whl文件,然后pip install。
注意:我的cuda版本是12.0,torch==1.10.1,经测试,可以使用torch-1.10.1+cu113这一组合,也就是说cuda是可以向下兼容的。