安装torch-sparse报错error: command ‘/usr/local/cuda-11.1/bin/nvcc‘ failed with exit status 1

报错信息

使用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是可以向下兼容的。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值