安装pointnet2_ops_lib时出错:“RuntimeError:The detected CUDA version(11.8)mismatches the version that was used to compile PyTorch(11.7).”

blmhpbnm  于 11个月前  发布在  其他
关注(0)|答案(1)|浏览(1026)

我正在使用Python 3.7从https://github.com/ZrrSkywalker/Point-NN/tree/main复制点云模型。
当我跑步时:

pip install pointnet2_ops_lib/.

字符串
我得到以下错误:

Looking in indexes: https://mirrors.nju.edu.cn/pypi/web/simple
Processing ./pointnet2_ops_lib
  Preparing metadata (setup.py) ... done
Requirement already satisfied: torch>=1.4 in /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages (from pointnet2-ops==3.0.0) (1.13.1)
Requirement already satisfied: typing-extensions in /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages (from torch>=1.4->pointnet2-ops==3.0.0) (4.3.0)
Requirement already satisfied: nvidia-cuda-runtime-cu11==11.7.99 in /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages (from torch>=1.4->pointnet2-ops==3.0.0) (11.7.99)
Requirement already satisfied: nvidia-cudnn-cu11==8.5.0.96 in /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages (from torch>=1.4->pointnet2-ops==3.0.0) (8.5.0.96)
Requirement already satisfied: nvidia-cublas-cu11==11.10.3.66 in /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages (from torch>=1.4->pointnet2-ops==3.0.0) (11.10.3.66)
Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages (from torch>=1.4->pointnet2-ops==3.0.0) (11.7.99)
Requirement already satisfied: setuptools in /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.4->pointnet2-ops==3.0.0) (49.2.1)
Requirement already satisfied: wheel in /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.4->pointnet2-ops==3.0.0) (0.41.2)
Building wheels for collected packages: pointnet2-ops
  Building wheel for pointnet2-ops (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [91 lines of output]
      No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.7
      creating build/lib.linux-x86_64-3.7/pointnet2_ops
      copying pointnet2_ops/__init__.py -> build/lib.linux-x86_64-3.7/pointnet2_ops
      copying pointnet2_ops/_version.py -> build/lib.linux-x86_64-3.7/pointnet2_ops
      copying pointnet2_ops/pointnet2_modules.py -> build/lib.linux-x86_64-3.7/pointnet2_ops
      copying pointnet2_ops/pointnet2_utils.py -> build/lib.linux-x86_64-3.7/pointnet2_ops
      running egg_info
      writing pointnet2_ops.egg-info/PKG-INFO
      writing dependency_links to pointnet2_ops.egg-info/dependency_links.txt
      writing requirements to pointnet2_ops.egg-info/requires.txt
      writing top-level names to pointnet2_ops.egg-info/top_level.txt
      reading manifest file 'pointnet2_ops.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      writing manifest file 'pointnet2_ops.egg-info/SOURCES.txt'
      creating build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src
      creating build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/include
      copying pointnet2_ops/_ext-src/include/ball_query.h -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/include
      copying pointnet2_ops/_ext-src/include/cuda_utils.h -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/include
      copying pointnet2_ops/_ext-src/include/group_points.h -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/include
      copying pointnet2_ops/_ext-src/include/interpolate.h -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/include
      copying pointnet2_ops/_ext-src/include/sampling.h -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/include
      copying pointnet2_ops/_ext-src/include/utils.h -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/include
      creating build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/ball_query.cpp -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/ball_query_gpu.cu -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/bindings.cpp -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/group_points.cpp -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/group_points_gpu.cu -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/interpolate.cpp -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/interpolate_gpu.cu -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/sampling.cpp -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      copying pointnet2_ops/_ext-src/src/sampling_gpu.cu -> build/lib.linux-x86_64-3.7/pointnet2_ops/_ext-src/src
      running build_ext
      /home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages/torch/utils/cpp_extension.py:365: UserWarning:

                                     !! WARNING !!

      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      Your compiler (g++ 4.8.5) may be ABI-incompatible with PyTorch!
      Please use a compiler that is ABI-compatible with GCC 5.0 and above.
      See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.

      See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
      for instructions on how to install GCC 5 or higher.
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                                    !! WARNING !!

        warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/3DVision2021/yifeiwang/Point-NN/pointnet2_ops_lib/setup.py", line 38, in <module>
          include_package_data=True,
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages/setuptools/__init__.py", line 165, in setup
          return distutils.core.setup(**attrs)
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 87, in run
          _build_ext.run(self)
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/distutils/command/build_ext.py", line 340, in run
          self.build_extensions()
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 499, in build_extensions
          _check_cuda_version(compiler_name, compiler_version)
        File "/home/3DVision2021/.conda/envs/pointnn/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 386, in _check_cuda_version
          raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda))
      RuntimeError:
      The detected CUDA version (11.8) mismatches the version that was used to compile
      PyTorch (11.7). Please make sure to use the same CUDA versions.

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pointnet2-ops
  Running setup.py clean for pointnet2-ops
Failed to build pointnet2-ops
ERROR: Could not build wheels for pointnet2-ops, which is required to install pyproject.toml-based projects


我已经尝试

pip install --upgrade setuptools
pip install nes-py --no-cache-dir
pip install --upgrade pip setuptools wheel


但它并不能修复错误。
我该如何解决此问题?

iklwldmw

iklwldmw1#

我通过以下步骤解决了这个问题:
1.从错误中发现环境没有编译好,推测环境可能缺少pytorch-cuda包,安装相应的包:

pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

字符串
1.安装包后,发现可以编译,但显示错误消息:
您的编译器(g++ 4.8.5)可能与PyTorch ABI不兼容!请使用与GCC 5.0及更高版本ABI兼容的编译器。请参阅https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html。有关如何安装GCC 5或更高版本的说明,请参阅https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
核心错误是“您运行的GCC版本太旧。我们需要GCC 5或更高版本”。安装超过5个版本的GCC(经过验证,似乎只有5个版本适用)。在https://anaconda.org/上找到适当的软件包安装。例如:

conda install -c psi4 gcc-5-mp


pointnet2_ops_lib/就可以成功安装了。

相关问题