PointTransformer编译pointops_cuda报错fatal error: THC/THC.h: No such file or directory

17 篇文章 1 订阅
14 篇文章 0 订阅

错误信息

  • Ubuntu 20.04
  • CUDA 11.6
  • PyTorch 1.13.0

尝试运行PointTransformer代码, 编译pointops_cuda的时候报错:

> py setup.py install
running install
/home/dl/.conda/envs/dl/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/dl/.conda/envs/dl/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
creating pointops.egg-info
writing pointops.egg-info/PKG-INFO
writing dependency_links to pointops.egg-info/dependency_links.txt
writing top-level names to pointops.egg-info/top_level.txt
writing manifest file 'pointops.egg-info/SOURCES.txt'
/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'pointops.egg-info/SOURCES.txt'
writing manifest file 'pointops.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'pointops_cuda' extension
creating build
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/src
creating build/temp.linux-x86_64-cpython-38/src/aggregation
creating build/temp.linux-x86_64-cpython-38/src/grouping
creating build/temp.linux-x86_64-cpython-38/src/interpolation
creating build/temp.linux-x86_64-cpython-38/src/knnquery
creating build/temp.linux-x86_64-cpython-38/src/sampling
creating build/temp.linux-x86_64-cpython-38/src/subtraction
gcc -pthread -B /home/dl/.conda/envs/dl/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/include -I/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/include/TH -I/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/include/THC -I/home/dl/.conda/envs/dl/include -I/home/dl/.conda/envs/dl/include/python3.8 -c src/aggregation/aggregation_cuda.cpp -o build/temp.linux-x86_64-cpython-38/src/aggregation/aggregation_cuda.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=pointops_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
src/aggregation/aggregation_cuda.cpp:2:10: fatal error: THC/THC.h: 没有那个文件或目录
    2 | #include <THC/THC.h>
      |          ^~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
(dl) dl@kemove-desktop:~/point-transformer/lib/pointops$ py setup.py install
running install
/home/dl/.conda/envs/dl/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/dl/.conda/envs/dl/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing pointops.egg-info/PKG-INFO
writing dependency_links to pointops.egg-info/dependency_links.txt
writing top-level names to pointops.egg-info/top_level.txt
/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'pointops.egg-info/SOURCES.txt'
writing manifest file 'pointops.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'pointops_cuda' extension
gcc -pthread -B /home/dl/.conda/envs/dl/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/include -I/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/include/TH -I/home/dl/.conda/envs/dl/lib/python3.8/site-packages/torch/include/THC -I/home/dl/.conda/envs/dl/include -I/home/dl/.conda/envs/dl/include/python3.8 -c src/aggregation/aggregation_cuda.cpp -o build/temp.linux-x86_64-cpython-38/src/aggregation/aggregation_cuda.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=pointops_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
src/aggregation/aggregation_cuda.cpp:2:10: fatal error: THC/THC.h: 没有那个文件或目录
    2 | #include <THC/THC.h>
      |          ^~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1

原因

原因是pytorch 1.9之后的某个版本删除了THC.h, 参考 fatal error: THC/THC.h: No such file or directory - CSDN

解决方法

先排除2个正确答案:
老老实实运行储存库提供的env_setup.sh新装一个pytorch=1.9.0的环境。
降级pytorch1.9.0

我使用的是下述方法:
Ctrl+Shift+F全局搜索并删除每一行#include <THC/THC.h>
在这里插入图片描述
然后再编译就能通过了

  • 9
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值