pip install torch-points-kernels失败问题的解决

pip install torch-points-kernels失败问题的解决

在windows安装torch-points-kernels会报错

解决方案如下

到官方的代码库把代码down下来

地址:https://github.com/torch-points3d/torch-points-kernels

you can compile the wheel yourself for any PyTorch/CUDA combination (must have a matching installation of CUDA toolkit):
你可以根据你的需求自己编译适用于特定PyTorch和CUDA版本的软件包。
注意:在这种情况下,你需要确保已经正确安装了相应版本的CUDA toolkit。通过编译wheel,你可以获得一个预编译的二进制软件包,可供你在特定的环境中使用。

  1. 下载torch-points-kernels
pip install torch-points-kernels
  1. 构建和测试
python setup.py build_ext --inplace
python -m unittest

新问题

但是我执行pip install torch-points-kernels还是出现了两个错误

1. 编译错误提示需要Microsoft Visual C++ 14.0或更高版本

UserWarning: The detected CUDA version (11.2) has a minor version
 mismatch with the version that was used to compile PyTorch (11.8). Most likely this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      building 'torch_points_kernels.points_cuda' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tool
s/

解决方案:

1 下载并安装 Microsoft Visual C++ Build Tools:

2 配置Visual C++ Build Tools:

  • 安装完成后,打开Visual C++ Build Tools。
  • 确保在安装选项中选择了"C++ build tools"和"MSVCv142 - VS 2019 C++ x64/x86 build tools"。
  • 完成安装后,重新启动计算机。
    这里我是装的2019版本的

2. 检测到的CUDA版本(11.2)与用于编译PyTorch的版本(11.8)存在轻微版本不匹配。
windows上装的cuda11.2,但是我的conda环境中cuda是11.8

  D:\ProgramData\anaconda3\envs\Pytorch_base\lib\site-packages\torch\utils\cpp_extension.py:414: UserWarning: The detected CUDA version (11.2) has a minor v
ersion mismatch with the version that was used to compile PyTorch (11.8). Most likely this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      building 'torch_points_kernels.points_cuda' extension
      creating build\temp.win-amd64-cpython-38
      creating build\temp.win-amd64-cpython-38\Release
      creating build\temp.win-amd64-cpython-38\Release\cuda
      creating build\temp.win-amd64-cpython-38\Release\cuda\src
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Icu
da/include -ID:\ProgramData\anaconda3\envs\Pytorch_base\lib\site-packages\torch\include -ID:\ProgramData\anaconda3\envs\Pytorch_base\lib\site-packages\torch\inc
lude\torch\csrc\api\include -ID:\ProgramData\anaconda3\envs\Pytorch_base\lib\site-packages\torch\include\TH -ID:\ProgramData\anaconda3\envs\Pytorch_base\lib\sit
e-packages\torch\include\THC "-ID:\Program Files\NVIDA GPU Computing Toolkit\CUDA\v11.2\include" -ID:\ProgramData\anaconda3\envs\Pytorch_base\include -ID:\Progr
amData\anaconda3\envs\Pytorch_base\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Fi
les (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Ki
ts\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.1904
1.0\cppwinrt" /EHsc /Tpcuda/src\ball_query.cpp /Fobuild\temp.win-amd64-cpython-38\Release\cuda/src\ball_query.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /w
d4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -O3 -DVERSION_GE_1_3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=points_c
uda -DTORCH_EXTENSION_NAME=points_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17
      cl: 命令行 warning D9002 :忽略未知选项“-O3”
      ball_query.cpp
      D:\ProgramData\anaconda3\envs\Pytorch_base\lib\site-packages\torch\include\pybind11\detail/common.h(210): warning C4005: “HAVE_SNPRINTF”: 宏重定义        
      D:\ProgramData\anaconda3\envs\Pytorch_base\include\pyerrors.h(315): note: 参见“HAVE_SNPRINTF”的前一个定义
      "D:\Program Files\NVIDA GPU Computing Toolkit\CUDA\v11.2\bin\nvcc" -c cuda/src\ball_query_gpu.cu -o build\temp.win-amd64-cpython-38\Release\cuda/src\ball_
query_gpu.obj -Icuda/include -ID:\ProgramData\anaconda3\envs\Pytorch_base\lib\site-packages\torch\include -ID:\ProgramData\anaconda3\envs\Pytorch_base\lib\site-
packages\torch\include\torch\csrc\api\include -ID:\ProgramData\anaconda3\envs\Pytorch_base\lib\site-packages\torch\include\TH -ID:\ProgramData\anaconda3\envs\Py
torch_base\lib\site-packages\torch\include\THC "-ID:\Program Files\NVIDA GPU Computing Toolkit\CUDA\v11.2\include" -ID:\ProgramData\anaconda3\envs\Pytorch_base\
include -ID:\ProgramData\anaconda3\envs\Pytorch_base\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include
" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program File
s (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10
\include\10.0.19041.0\cppwinrt" -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -
Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4068 -Xcompil
er /wd4067 -Xcompiler /wd4624 -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd48
19 -Xcompiler /MD -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-co
nstexpr -O3 -DVERSION_GE_1_3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=points_cuda -DTORCH_EXTENSION_NAME=points_cu
da -D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17 --use-local-env
      nvcc fatal   : Unsupported gpu architecture 'compute_89'
      error: command 'D:\\Program Files\\NVIDA GPU Computing Toolkit\\CUDA\\v11.2\\bin\\nvcc.exe' failed with exit code 1

解决方法:
把conda环境中的pytorch适配的cuda重装改成和windows一样的版本,但可能新下载的cuda不适配pytorch版本。
或者再到cuda官网重新下载一个11.8版本的,修改环境变量,让系统优先使用cuda11。 网上有很多让不同版本cuda共存的博客,这里我不再赘述。

做完这些重新执行上面的命令
结果展示:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值