alexandrosstergiou / SoftPool

[ICCV 2021] Code for approximated exponential maximum pooling
MIT License
288 stars 52 forks source link

Failed to install #30

Closed hbwslms closed 3 years ago

hbwslms commented 3 years ago

Thanks for your work!

There're some errors when installing.

`rm -rf *.egg-info rm -rf build dist python setup.py install running install running bdist_egg running egg_info creating SoftPool.egg-info writing SoftPool.egg-info/PKG-INFO writing dependency_links to SoftPool.egg-info/dependency_links.txt writing top-level names to SoftPool.egg-info/top_level.txt writing manifest file 'SoftPool.egg-info/SOURCES.txt' writing manifest file 'SoftPool.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build creating build/lib.linux-x86_64-3.8 creating build/lib.linux-x86_64-3.8/SoftPool copying SoftPool/idea.py -> build/lib.linux-x86_64-3.8/SoftPool copying SoftPool/init.py -> build/lib.linux-x86_64-3.8/SoftPool running build_ext building 'softpool_cuda' extension creating /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8 creating /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/CUDA Emitting ninja build file /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/2] :/usr/local/cuda-11.1:/usr/local/cuda-11.1/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/CUDA/softpool_cuda_kernel.o.d -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/TH -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/THC -I:/usr/local/cuda-11.1:/usr/local/cuda-11.1/include -I/home/n504/anaconda3/envs/pytorch17/include/python3.8 -c -c /home/n504/Downloads/SoftPool/pytorch/CUDA/softpool_cuda_kernel.cu -o /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/CUDA/softpool_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=softpool_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/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/CUDA/softpool_cuda_kernel.o :/usr/local/cuda-11.1:/usr/local/cuda-11.1/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/CUDA/softpool_cuda_kernel.o.d -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/TH -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/THC -I:/usr/local/cuda-11.1:/usr/local/cuda-11.1/include -I/home/n504/anaconda3/envs/pytorch17/include/python3.8 -c -c /home/n504/Downloads/SoftPool/pytorch/CUDA/softpool_cuda_kernel.cu -o /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/CUDA/softpool_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=softpool_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14 /bin/sh: 1: :/usr/local/cuda-11.1:/usr/local/cuda-11.1/bin/nvcc: not found [2/2] c++ -MMD -MF /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/CUDA/softpool_cuda.o.d -pthread -B /home/n504/anaconda3/envs/pytorch17/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/TH -I/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/THC -I:/usr/local/cuda-11.1:/usr/local/cuda-11.1/include -I/home/n504/anaconda3/envs/pytorch17/include/python3.8 -c -c /home/n504/Downloads/SoftPool/pytorch/CUDA/softpool_cuda.cpp -o /home/n504/Downloads/SoftPool/pytorch/build/temp.linux-x86_64-3.8/CUDA/softpool_cuda.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=softpool_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++ In file included from /home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:140:0, from /home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3, from /home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5, from /home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3, from /home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:13, from /home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/torch/extension.h:4, from /home/n504/Downloads/SoftPool/pytorch/CUDA/softpool_cuda.cpp:1: /home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/include/ATen/ParallelOpenMP.h:83:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]

pragma omp parallel for if ((end - begin) >= grain_size)

ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1667, in _run_ninja_build subprocess.run( File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/subprocess.py", line 512, 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 "setup.py", line 4, in setup( File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/setuptools/init.py", line 153, in setup return distutils.core.setup(**attrs) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/setuptools/command/install.py", line 67, in run self.do_egg_install() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/setuptools/command/install.py", line 109, in do_egg_install self.run_command('bdist_egg') File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 167, in run cmd = self.call_command('install_lib', warn_dir=0) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 153, in call_command self.run_command(cmdname) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run _build_ext.run(self) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 708, in build_extensions build_ext.build_extensions(self) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 196, in build_extension _build_ext.build_extension(self, ext) File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension objects = self.compiler.compile(sources, File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 529, in unix_wrap_ninja_compile _write_ninja_file_and_compile_objects( File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1354, in _write_ninja_file_and_compile_objects _run_ninja_build( File "/home/n504/anaconda3/envs/pytorch17/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1683, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension Makefile:2: recipe for target 'install' failed make: *** [install] Error 1`

And I'm sure that I've cuda installed and added it into path. output of command $nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2020 NVIDIA Corporation Built on Mon_Oct_12_20:09:46_PDT_2020 Cuda compilation tools, release 11.1, V11.1.105 Build cuda_11.1.TC455_06.29190527_0 output of command $echo $PATH: /home/n504/anaconda3/envs/pytorch17/bin:/home/n504/anaconda3/condabin:/usr/local/cuda-11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda-11.1/bin

alexandrosstergiou commented 3 years ago

Hi @hbwslms,

The most common cause for such installation errors, based on different tests on different machines, has been a mismatch between GCC and the CUDA version.

CUDAVER=cuda-11.2
export PATH=/usr/local/$CUDAVER/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/$CUDAVER/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/$CUDAVER/lib64:$LD_LIBRARY_PATH
export CUDA_PATH=/usr/local/$CUDAVER
export CUDA_ROOT=/usr/local/$CUDAVER
export CUDA_HOME=/usr/local/$CUDAVER
export CUDA_HOST_COMPILER=/usr/bin/gcc-<your_version>

You should be able to install it without errors (warning of half-precision are normal).

sources: 1 2

Alternatively, you can use the repo without installing it and by simply copying it within your working directory.

Best, Alex

hbwslms commented 3 years ago

@alexandrosstergiou OK, THX!

alexandrosstergiou commented 3 years ago

Will close this due to inactivity. Feel free to open a new issue if other problems occur.

Best, Alex