megvii-research / TreeEnergyLoss

[CVPR2022] Tree Energy Loss: Towards Sparsely Annotated Semantic Segmentation
Other
103 stars 8 forks source link

Error in executing "sudo python3 setup.py build develop" #2

Closed Carlisle-Liu closed 2 years ago

Carlisle-Liu commented 2 years ago

May I know what is the "LD_LIBRARY_PATH" I should set in order to build extension? So far I have run into the following error message consistently:

['/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/mst/boruvka.cpp', '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/bfs/bfs.cu', '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/mst/mst.cu', '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/refine/refine.cu', '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/tree_filter.cpp'] running build running build_ext /home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/utils/cpp_extension.py:788: UserWarning: The detected CUDA version (11.6) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem. warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda)) building 'tree_filter_cuda' extension Emitting ninja build file /home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/3] /usr/local/cuda/bin/nvcc '-I/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src' -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/TH -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/carlisle_liu/anaconda3/envs/TEL/include/python3.9 -c -c '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/refine/refine.cu' -o '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/refine/refine.o' -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=tree_filter_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 FAILED: /home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/refine/refine.o /usr/local/cuda/bin/nvcc '-I/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src' -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/TH -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/carlisle_liu/anaconda3/envs/TEL/include/python3.9 -c -c '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/refine/refine.cu' -o '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/refine/refine.o' -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=tree_filter_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 /home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/refine/refine.cu:12:10: fatal error: THC/THC.h: No such file or directory 12 | #include <THC/THC.h> | ^~~ compilation terminated. [2/3] /usr/local/cuda/bin/nvcc '-I/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src' -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/TH -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/carlisle_liu/anaconda3/envs/TEL/include/python3.9 -c -c '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/bfs/bfs.cu' -o '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/bfs/bfs.o' -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=tree_filter_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 FAILED: /home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/bfs/bfs.o /usr/local/cuda/bin/nvcc '-I/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src' -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/TH -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/carlisle_liu/anaconda3/envs/TEL/include/python3.9 -c -c '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/bfs/bfs.cu' -o '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/bfs/bfs.o' -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=tree_filter_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 /home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/bfs/bfs.cu:12:10: fatal error: THC/THC.h: No such file or directory 12 | #include <THC/THC.h> | ^~~ compilation terminated. [3/3] /usr/local/cuda/bin/nvcc '-I/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src' -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/TH -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/carlisle_liu/anaconda3/envs/TEL/include/python3.9 -c -c '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/mst/mst.cu' -o '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/mst/mst.o' -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=tree_filter_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 FAILED: /home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/mst/mst.o /usr/local/cuda/bin/nvcc '-I/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src' -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/TH -I/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/carlisle_liu/anaconda3/envs/TEL/include/python3.9 -c -c '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/mst/mst.cu' -o '/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/build/temp.linux-x86_64-3.9/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/mst/mst.o' -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=tree_filter_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 /home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/src/mst/mst.cu:9:10: fatal error: THC/THC.h: No such file or directory 9 | #include <THC/THC.h> | ^~~ compilation terminated. ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1740, in _run_ninja_build subprocess.run( File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/carlisle_liu/Documents/Project/Smoke Segmentation/Code/TreeEnergyLoss/kernels/lib_tree_filter/setup.py", line 25, in setup( File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/setuptools/init.py", line 153, in setup return distutils.core.setup(**attrs) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/core.py", line 148, in setup dist.run_commands() File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run _build_ext.run(self) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 741, in build_extensions build_ext.build_extensions(self) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/command/build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/command/build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 202, in build_extension _build_ext.build_extension(self, ext) File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/distutils/command/build_ext.py", line 529, in build_extension objects = self.compiler.compile(sources, File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 562, in unix_wrap_ninja_compile _write_ninja_file_and_compile_objects( File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1419, in _write_ninja_file_and_compile_objects _run_ninja_build( File "/home/carlisle_liu/anaconda3/envs/TEL/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1756, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension

Kind regards, Jiawei

liangzhiyuanCV commented 2 years ago

Hi, Jiawei. The latest version of PyTorch (1.11) has removed THC/THC.h and an earlier version may be helpful. Our experimental environment is built on PyTorch (1.7.1) with CUDA (10.0).

weixuansun commented 2 years ago

Hi there, I also have issues when compiling, I wonder what GCC version do you use?

liangzhiyuanCV commented 2 years ago

Hi there, I also have issues when compiling, I wonder what GCC version do you use?

The GCC version is 7.5.0 in our experimental environment.

liangzhiyuan@hhb-ss:/data/liangzhiyuan/projects$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
JackyWang2001 commented 1 year ago

I ran into the similar issues under ubuntu22, cuda12, gcc11. The way I finally solved it is to add /usr/local/cuda12 to path.