本文介绍: 编译Pointnet2.PyTorch仓库中的setup.py时报THCTHC.h: No such file or directory。原因是THC.h在pytorch 1.11版本中被移除了,需要修改代码。部分仓库中setup.py文件在子文件夹中,需要使用pip install 从子文件夹中直接安装某个分支。比如上面这个PointNet2.Pytorch仓库的setup.py在子文件夹。

问题1描述
编译Pointnet2.PyTorch仓库中的setup.py时报THCTHC.h: No such file or directory。

问题解决
原因是THC.h在pytorch 1.11版本中被移除了,需要修改代码。仓库issues给除了解决方法:

//Comment Out /src/ball_query.cpp group_points.cpp interpolate.cpp pointnet2_api.cpp sampling.cpp
把上面列出的文件的以下行注释掉
//#include <THE/THC.h>
//extern THCState *state;
//cudaStream_t stream = THCState_getCurrentStream(state);

改为
#include <ATen/cuda/CUDAContext.h>
#include <ATen/cuda/CUDAEvent.h>
cudaStream_t stream = at::cuda::getCurrentCUDAStream();

然后
replace the AT_CHECK with TORCH_CHECK in the ball_query.cpp

问题2描述
部分仓库中setup.py文件在子文件夹中,需要使用pip install 从子文件夹中直接安装某个分支

解决方案
比如上面这个PointNet2.Pytorch仓库的setup.py在子文件夹pointnet2中,可以这样安装branch分支:

pip install git+https://github.com/sshaoshuai/Pointnet2.PyTorch.git@master#subdirectory=pointnet2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注