traveller59 / spconv

Spatial Sparse Convolution Library
Apache License 2.0
1.84k stars 362 forks source link

Error building wheel `python setup.py bdist_wheel` #167

Closed scrouzet closed 4 years ago

scrouzet commented 4 years ago

When trying to build the wheel for spconv I get this error that I do not know how to solve.

The machine is running Ubuntu 18.04, and this is in a miniconda env named pointpillars with Python 3.8 (could this be the issue?). I see in the output that it relies on cuda10-0 to compile, while this env is supposed to use cuda10-1 (I installed pytorch with the 10-1 toolkit). the cuda simlink to cuda10-1 so if this is what I should change, it may rather be inside spconv (or elsewhere?), thanks for letting me know.

Let me know if other specific info would be required for you to help. Thanks in advance of your help.

(pointpillars) XXXXXXXX@COMPUTER:~/src/spconv$ python setup.py bdist_wheel                                                                                                                                      
running bdist_wheel                                                                                                                                                                                          
running build                                                                                                                                                                                                
running build_py                                                                                                                                                                                             
running build_ext                                                                                                                                                                                            
Release                                                                                                                                                                                                      
|||||CMAKE ARGS||||| ['-DCMAKE_PREFIX_PATH=/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/site-packages/torch', '-DPYBIND11_PYTHON_VERSION=3.8', '-DSPCONV_BuildTests=OFF', '-DPYTORCH_VERSION=1050
0', '-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr" -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/XXXXXXXX/src/spconv/build/lib.linux-x86_64-3.8/spcon
v', '-DCMAKE_BUILD_TYPE=Release']                                                                                                                                                                            
-- The CUDA compiler identification is unknown                                                                                                                                                               
-- Check for working CUDA compiler: /usr/local/cuda-10.0/bin/nvcc                                                                                                                                            
-- Check for working CUDA compiler: /usr/local/cuda-10.0/bin/nvcc - broken                                                                                                                                   
CMake Error at /usr/share/cmake-3.17/Modules/CMakeTestCUDACompiler.cmake:46 (message):                                                                                                                       
  The CUDA compiler                                                                                                                                                                                          

    "/usr/local/cuda-10.0/bin/nvcc"                                                                                                                                                                          

  is not able to compile a simple test program.                                                                                                                                                              

  It fails with the following output:                                                                                                                                                                        

    Change Dir: /home/XXXXXXXX/src/spconv/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeTmp                                                                                                                    

    Run Build Command(s):/usr/bin/make cmTC_fccd1/fast && /usr/bin/make  -f CMakeFiles/cmTC_fccd1.dir/build.make CMakeFiles/cmTC_fccd1.dir/build                                                             
    make[1]: Entering directory '/home/XXXXXXXX/src/spconv/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeTmp'                                                                                                  
    Building CUDA object CMakeFiles/cmTC_fccd1.dir/main.cu.o                                                                                                                                                 
    /usr/local/cuda-10.0/bin/nvcc    "--expt-relaxed-constexpr" -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__    -x cu -c /home/XXXXXXXX/src/spconv/build/temp.linux-x86_64-3.8/CMakeFiles/CMak
eTmp/main.cu -o CMakeFiles/cmTC_fccd1.dir/main.cu.o                                                                                                                                                          
    In file included from <command-line>:0:0:                                                                                                                                                                
    /usr/local/cuda-10.0/bin/../targets/x86_64-linux/include/cuda_runtime.h:83:10: fatal error: crt/host_config.h: No such file or directory                                                                 
     #include "crt/host_config.h"                                                                                                                                                                            
              ^~~~~~~~~~~~~~~~~~~
    compilation terminated.
    CMakeFiles/cmTC_fccd1.dir/build.make:85: recipe for target 'CMakeFiles/cmTC_fccd1.dir/main.cu.o' failed
    make[1]: *** [CMakeFiles/cmTC_fccd1.dir/main.cu.o] Error 1
    make[1]: Leaving directory '/home/XXXXXXXX/src/spconv/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeTmp'
    Makefile:141: recipe for target 'cmTC_fccd1/fast' failed
    make: *** [cmTC_fccd1/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:6 (project)

-- Configuring incomplete, errors occurred!
See also "/home/XXXXXXXX/src/spconv/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeOutput.log".
See also "/home/XXXXXXXX/src/spconv/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "setup.py", line 97, in <module>
    setup(
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/site-packages/setuptools/__init__.py", line 161, in setup
    return distutils.core.setup(**attrs)
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 223, in run
    self.run_command('build')
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 49, in run
    self.build_extension(ext)
  File "setup.py", line 92, in build_extension
    subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
  File "/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/home/XXXXXXXX/src/spconv', '-DCMAKE_PREFIX_PATH=/home/XXXXXXXX/miniconda/envs/pointpillars/lib/python3.8/site-packages/torch', '-DPYBIND11_PYTHON_VERSION
=3.8', '-DSPCONV_BuildTests=OFF', '-DPYTORCH_VERSION=10500', '-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr" -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/
home/XXXXXXXX/src/spconv/build/lib.linux-x86_64-3.8/spconv', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
scrouzet commented 4 years ago

This is the output of nvcc -V. Still the setup.py uses the 10.0 CUDA COMPILER.

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
gauravjindal3513 commented 4 years ago

Can you try adding '-DCMAKE_CUDA_COMPILER=/usr/local/cuda-10.1/bin/nvcc' in cmake_args in setup.py and run again.

For example: cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir + "/spconv", '-DCMAKE_PREFIX_PATH=' + LIBTORCH_ROOT, '-DPYBIND11_PYTHON_VERSION={}'.format(PYTHON_VERSION), '-DCMAKE_CUDA_COMPILER=/usr/local/cuda-10.1/bin/nvcc', '-DSPCONV_BuildTests=OFF', '-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr"']

scrouzet commented 4 years ago

@gauravjindal3513 I did it and it worked.

There was then a new error nvcc fatal : Unknown option 'Wall', but this was solved by commenting 2 lines in the file Caffe2Targets.cmake (pytorch package) as indicated in https://github.com/traveller59/spconv/issues/69.

Thanks!