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

ERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=sparse_conv_ext -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 FAILED: /tmp/pip-install-2orq3ccd/mmdet3d_bedd1fa9197349c4b23a2ae1df261803/build/temp.linux-x86_64-cpython-38/mmdet3d/ops/spconv/src/indice_cuda.o /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/tmp/pip-install-2orq3ccd/mmdet3d_bedd1fa9197349c4b23a2ae1df261803/mmdet3d/ops/spconv/include -I/root/miniconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/include -I/root/miniconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/root/miniconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/include/TH -I/root/miniconda3/envs/open-mmlab/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda/include -I/root/miniconda3/envs/open-mmlab/include/python3.8 -c -c /tmp/pip-install-2orq3ccd/mmdet3d_bedd1fa9197349c4b23a2ae1df261803/mmdet3d/ops/spconv/src/indice_cuda.cu -o /tmp/pip-install-2orq3ccd/mmdet3d_bedd1fa9197349c4b23a2ae1df261803/build/temp.linux-x86_64-cpython-38/mmdet3d/ops/spconv/src/indice_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -w -std=c++14 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=sparse_conv_ext -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 /tmp/pip-install-2orq3ccd/mmdet3d_bedd1fa9197349c4b23a2ae1df261803/mmdet3d/ops/spconv/src/indice_cuda.cu:16:10: fatal error: spconv/indice.cu.h: No such file or directory 16 | #include <spconv/indice.cu.h> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值