[Windows] pip install pointnet2_ops报错解决

[Windows]pip install pointnet2_ops报错解决

报错信息👀

(m2t2) PS F:\code_project\Gitub_projects\M2T2-master> pip install pointnet2_ops/ -i https://pypi.douban.com/simple
Looking in indexes: https://pypi.douban.com/simple
Processing f:\code_project\gitub_projects\m2t2-master\pointnet2_ops
  Preparing metadata (setup.py) ... done
Requirement already satisfied: torch>=1.4 in e:\anaconda\envs\m2t2\lib\site-packages (from pointnet2_ops==3.0.0) (2.0.1)
Requirement already satisfied: filelock in e:\anaconda\envs\m2t2\lib\site-packages (from torch>=1.4->pointnet2_ops==3.0.0) (3.13.1)
Requirement already satisfied: typing-extensions in e:\anaconda\envs\m2t2\lib\site-packages (from torch>=1.4->pointnet2_ops==3.0.0) (4.10.0)
Requirement already satisfied: sympy in e:\anaconda\envs\m2t2\lib\site-packages (from torch>=1.4->pointnet2_ops==3.0.0) (1.12)
Requirement already satisfied: networkx in e:\anaconda\envs\m2t2\lib\site-packages (from torch>=1.4->pointnet2_ops==3.0.0) (3.2.1)
Requirement already satisfied: jinja2 in e:\anaconda\envs\m2t2\lib\site-packages (from torch>=1.4->pointnet2_ops==3.0.0) (3.1.3)
Requirement already satisfied: MarkupSafe>=2.0 in e:\anaconda\envs\m2t2\lib\site-packages (from jinja2->torch>=1.4->pointnet2_ops==3.0.0) (2.1.5)
Requirement already satisfied: mpmath>=0.19 in e:\anaconda\envs\m2t2\lib\site-packages (from sympy->torch>=1.4->pointnet2_ops==3.0.0) (1.3.0)
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
  ╰─> [40 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\pointnet2_ops
      copying pointnet2_ops\pointnet2_modules.py -> build\lib.win-amd64-cpython-310\pointnet2_ops
      copying pointnet2_ops\pointnet2_utils.py -> build\lib.win-amd64-cpython-310\pointnet2_ops
      copying pointnet2_ops\_version.py -> build\lib.win-amd64-cpython-310\pointnet2_ops
      copying pointnet2_ops\__init__.py -> build\lib.win-amd64-cpython-310\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.win-amd64-cpython-310\pointnet2_ops\_ext-src
      creating build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\include
      copying pointnet2_ops\_ext-src\include\ball_query.h -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\include
      copying pointnet2_ops\_ext-src\include\cuda_utils.h -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\include
      copying pointnet2_ops\_ext-src\include\group_points.h -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\include
      copying pointnet2_ops\_ext-src\include\interpolate.h -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\include
      copying pointnet2_ops\_ext-src\include\sampling.h -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\include
      copying pointnet2_ops\_ext-src\include\utils.h -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\include
      creating build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\ball_query.cpp -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\ball_query_gpu.cu -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\bindings.cpp -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\group_points.cpp -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\group_points_gpu.cu -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\interpolate.cpp -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\interpolate_gpu.cu -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\sampling.cpp -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      copying pointnet2_ops\_ext-src\src\sampling_gpu.cu -> build\lib.win-amd64-cpython-310\pointnet2_ops\_ext-src\src
      running build_ext
      E:\Anaconda\envs\m2t2\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
        warnings.warn(f'Error checking compiler version for {compiler}: {error}')
      error: [WinError 2] 系统找不到指定的文件。
      [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
(m2t2) PS F:\code_project\Gitub_projects\M2T2-master>

关键报错如下,就是说定位不到符合版本的cl文件:
在这里插入图片描述

解谜开始😥

先喂给GPT问下:

得到关键信息,我们需要对应版本的VS Build Tools.

此外查找相关博客,参考链接

了解到_MSC_VER是MSVC编译器的内置宏,定义了编译器的版本。

定位到报错信息中的源文件:

在这里插入图片描述

可以看出cl.exe的版本要求:

MINIMUM_MSVC_VERSION = (19, 0, 24215)

在本机电脑中找到了VS2017的MSVC版本:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC
在这里插入图片描述

如何对应版本号?🤨

Microsoft Visual C++ - Wikipedia

我尝试根据表中所列的对照关系,定位到了_MSC_VER为1924的一栏,可以看到应该是VS2019的版本,且版本号为16.4.0
在这里插入图片描述

接下来我们去到VS官网,如下图所示,下载链接对应版本号的BuildTools.

在这里插入图片描述

验证🤮

安装完成:

在这里插入图片描述

找到默认安装路径:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools

打开目录又傻眼了,翻了半天没找到MSVC文件夹,好像不太一样欸:

在这里插入图片描述

应该是没装全,去包管理点击修改:

在这里插入图片描述

勾上C++生成工具,然后右侧选择前两个,开始安装。
在这里插入图片描述

安装完成,呼~,似乎看到了希望:

在这里插入图片描述

尝试点开了其中一个路径:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64

在这里插入图片描述

配置环境变量(便于找到cl.exe)⭐

把这个路径加到系统环境变量的PATH中,尝试一手再次执行:

在这里插入图片描述

fa fa fa 好消息是没有cl报错了,注意到Unicode,应该是编码问题,继续定位报错行,如下出现的解码格式:
在这里插入图片描述
在这里插入图片描述

oem修改为utf-8一试:
在这里插入图片描述

依然报错,少了具体报错行🫵🤮

打印输出match对象(匹配到的version号):

在这里插入图片描述

总结梳理⭐⭐⭐

windows编码问题(autorun)

参考博客

终端由于在注册表设置了autorun(历史遗留问题,应该是大一写C遇到终端乱码学的解决方式🫥),每次启动都会设置编码为utf-8.这样会导致visual studio终端启动报错(vcvarsall.bat)。

在这里插入图片描述

如下图所示,找到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor,将Autorun删除即可。
在这里插入图片描述

调用vs检查编码问题

参考博客

在终端输入如下命令:

cmd.exe /c "E:\VS2019\VC\Auxiliary\Build\vcvars64.bat"

在这里插入图片描述

至此,无需在cpp_extension.py中修改解码方式。

在这里插入图片描述

Visual Studio版本问题

[VS2019+CUDA] fatal error: #error: – C1189: unsupported Microsoft Visual Studio version!_fatal error c1189: #error: – unsupported microsof-CSDN博客

如果VS和CUDA版本不适配,也会遇到问题,我起初电脑上装的有VS2022,VS2019,2022和我安装的CUDA11.1不适配,这里报错图不再贴出。

经过卸载重装,下了VS2019和VS2017,但是依然报错,随后参考了一篇博客内容,修改MSVC的版本控制。

在这里插入图片描述

系统CUDA与conda安装的CUDA

注意区分……

ninja包

参考博客

这个错误的出现主要是因为pytorch版本大于1.5,可行的解决方法有三个:

  1. 将pytorch版本降到1.5以下;(本末倒置

  2. 将报错的源码torch/utils/cpp_extension.py中的[‘ninja’,‘-v’]修改为[‘ninja’,‘—version’]不推荐,试过后产生了新的报错……

    在这里插入图片描述

  3. pointnet2/setup.py中cmdclass修改,pytorch默认使用ninjia作为backend,这里把它禁用掉。

    在这里插入图片描述

编译成功🫵😁

在这里插入图片描述
究极折磨,我为什么要在windows上装🥶🥶🥶

  • 24
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
根据引用和引用的信息来看,"ModuleNotFoundError: No module named 'pointnet2_ops'"是一个Python模块未找到的错误。这个错误通常发生在执行代码时,Python无法找到名为'pointnet2_ops'的模块。 解决这个问题的一个方法是根据引用中提供的安装方法来安装'pointnet2_ops'模块。可以使用以下命令来安装该模块: pip install "git https://github.com/erikwijmans/Pointnet2_PyTorch.git#egg=pointnet2_ops&subdirectory=pointnet2_ops_lib" 安装完成后,再次执行代码应该就不会再出现"ModuleNotFoundError"的错误了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [from pointnet2_ops import pointnet2_utils 安装过程](https://blog.csdn.net/goodgoodstudy___/article/details/128338442)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [使用PointRCNN训练自己数据集,ModuleNotFoundError: No module named ‘pointnet2_cuda‘问题](https://blog.csdn.net/weixin_45054427/article/details/130253858)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

路飞DoD

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值