jkulhanek / tetra-nerf

Official implementation for Tetra-NeRF paper - NeRF represented as triangulation of input point cloud.
https://jkulhanek.com/tetra-nerf
MIT License
278 stars 14 forks source link

Failed when install #17

Closed liuxiaozhu01 closed 1 year ago

liuxiaozhu01 commented 1 year ago

I have already installed all dependency well. And as I try to install it by the following command

pip install git+https://github.com/jkulhanek/tetra-nerf

The error occurs:

-- Build files have been written to: /tmp/pip-req-build-hxqb47bd
      [ 12%] Building NVCC ptx file build/traversal_generated_optix_traversal.cu.ptx
      [ 25%] compiling (and embedding ptx from)
      [ 37%] Building CUDA object CMakeFiles/tetranerf_cpp_extension.dir/src/tetrahedra_tracer.cu.o
      [ 50%] Building CXX object CMakeFiles/tetranerf_cpp_extension.dir/src/tetrahedra_tracer.cpp.o
      /tmp/pip-req-build-hxqb47bd/src/tetrahedra_tracer.cpp: In function ‘void context_log_cb(unsigned int, const char*, const char*, void*)’:
      /tmp/pip-req-build-hxqb47bd/src/tetrahedra_tracer.cpp:32:30: error: ‘setw’ is not a member of ‘std’
           std::cerr << "[" << std::setw(2) << level << "][" << std::setw(12) << tag << "]: "
                                    ^~~~
      /tmp/pip-req-build-hxqb47bd/src/tetrahedra_tracer.cpp:32:30: note: suggested alternative: ‘get’
           std::cerr << "[" << std::setw(2) << level << "][" << std::setw(12) << tag << "]: "
                                    ^~~~
                                    get
      /tmp/pip-req-build-hxqb47bd/src/tetrahedra_tracer.cpp:32:63: error: ‘setw’ is not a member of ‘std’
           std::cerr << "[" << std::setw(2) << level << "][" << std::setw(12) << tag << "]: "
                                                                     ^~~~
      /tmp/pip-req-build-hxqb47bd/src/tetrahedra_tracer.cpp:32:63: note: suggested alternative: ‘get’
           std::cerr << "[" << std::setw(2) << level << "][" << std::setw(12) << tag << "]: "
                                                                     ^~~~
                                                                     get
      gmake[2]: *** [CMakeFiles/tetranerf_cpp_extension.dir/build.make:101: CMakeFiles/tetranerf_cpp_extension.dir/src/tetrahedra_tracer.cpp.o] Error 1
      gmake[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/tetranerf_cpp_extension.dir/all] Error 2
      gmake: *** [Makefile:91: all] Error 2
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-hxqb47bd/setup.py", line 122, in <module>
          setup(
        File "/usr/local/lib/python3.10/dist-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-req-build-hxqb47bd/setup.py", line 63, in run
          self.build_extension(ext)
        File "/tmp/pip-req-build-hxqb47bd/setup.py", line 108, in build_extension
          subprocess.run(["cmake", "--build", ".", *build_args], cwd=ext.sourcedir, check=True)
        File "/usr/lib/python3.10/subprocess.py", line 524, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tetra-nerf
  Running setup.py clean for tetra-nerf
Failed to build tetra-nerf
ERROR: Could not build wheels for tetra-nerf, which is required to install pyproject.toml-based projects

it seems that #include <iomanip> is needed in src/tetrahedra_tracer.cpp. So I try to install manually by

git clone https://github.com/jkulhanek/tetra-nerf.git
python setup.py install

and it failed again

Consolidate compiler generated dependencies of target tetranerf_cpp_extension
[ 12%] Building CXX object CMakeFiles/tetranerf_cpp_extension.dir/src/tetrahedra_tracer.cpp.o
[ 25%] Building CXX object CMakeFiles/tetranerf_cpp_extension.dir/src/triangulation.cpp.o
[ 37%] Building CXX object CMakeFiles/tetranerf_cpp_extension.dir/src/py_binding.cpp.o
[ 50%] Building CXX object CMakeFiles/tetranerf_cpp_extension.dir/build/traversal_generated_optix_traversal.cu.ptx_embedded.cpp.o
[ 62%] Linking CXX shared module tetranerf/utils/extension/tetranerf_cpp_extension.cpython-310-x86_64-linux-gnu.so
[100%] Built target tetranerf_cpp_extension
warning: install_lib: 'build/lib.linux-x86_64-cpython-310' does not exist -- no Python modules to install

Traceback (most recent call last):
  File "/remote-home/lzj/workspace/tetra-nerf/setup.py", line 122, in <module>
    setup(
  File "/usr/local/lib/python3.10/dist-packages/setuptools/__init__.py", line 107, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 1234, in run_command
    super().run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/install.py", line 80, in run
    self.do_egg_install()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/install.py", line 129, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 1234, in run_command
    super().run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/bdist_egg.py", line 167, in run
    all_outputs, ext_outputs = self.get_ext_outputs()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/bdist_egg.py", line 299, in get_ext_outputs
    for ext in build_cmd.extensions:
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
    raise AttributeError(attr)
AttributeError: extensions

Can you please help? Thank you.

jkulhanek commented 1 year ago

Hi, can you please try to manually clone and run "cmake . && make"?

liuxiaozhu01 commented 1 year ago

"cmake . && make" runs well, and the extension (*.so) exists in tetranerf/utils/extension. But when i try to python setup.py install, it still outputs the same error.

Hi, can you please try to manually clone and run "cmake . && make"?

jkulhanek commented 1 year ago

Can you confim the path to the created .so? Can you try to add the tetranerf repo directory to the pythonpath and test if you can run the code?

liuxiaozhu01 commented 1 year ago

image and i add the repo directory to pythonpath, export PYTHONPATH=$PYTHONPATH:/root/home/workspace/tetra-nerf but it still not working.

jkulhanek commented 1 year ago

Ok, so it compiles fine. What is the exact error message when you set the pythonpath and try running some code?

liuxiaozhu01 commented 1 year ago

The complete error message is

workspace/tetra-nerf ‹master*›# python setup.py install
running install
/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()
running bdist_egg
running egg_info
writing tetra_nerf.egg-info/PKG-INFO
writing dependency_links to tetra_nerf.egg-info/dependency_links.txt
writing entry points to tetra_nerf.egg-info/entry_points.txt
writing requirements to tetra_nerf.egg-info/requires.txt
writing top-level names to tetra_nerf.egg-info/top_level.txt
reading manifest file 'tetra_nerf.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'tetra_nerf.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
-- Using torch libraries: /usr/local/lib/python3.10/dist-packages/torch/lib
-- Using torch includes: /usr/local/lib/python3.10/dist-packages/torch/include;/usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include;/usr/local/lib/python3.10/dist-packages/torch/include/TH;/usr/local/lib/python3.10/dist-packages/torch/include/THC
-- Using CUDA toolkit: /usr/local/cuda-11.8
-- Using CUDA architectures: 70
CMake Warning at /usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALConfig.cmake:92 (message):
  CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the
  default value of CGAL::data_file_path()
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)

-- Using header-only CGAL
-- Targetting Unix Makefiles
-- Using /usr/bin/c++ compiler.
-- Boost include dirs: /usr/include
-- Boost libraries:    
-- Using gcc version 4 or later. Adding -frounding-math
-- pybind11 v2.9.2 
-- Configuring done
-- Generating done
-- Build files have been written to: /root/home/workspace/tetra-nerf
Consolidate compiler generated dependencies of target tetranerf_cpp_extension
[100%] Built target tetranerf_cpp_extension
warning: install_lib: 'build/lib.linux-x86_64-cpython-310' does not exist -- no Python modules to install

Traceback (most recent call last):
  File "/remote-home/lzj/workspace/tetra-nerf/setup.py", line 122, in <module>
    setup(
  File "/usr/local/lib/python3.10/dist-packages/setuptools/__init__.py", line 107, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 1234, in run_command
    super().run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/install.py", line 80, in run
    self.do_egg_install()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/install.py", line 129, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 1234, in run_command
    super().run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/bdist_egg.py", line 167, in run
    all_outputs, ext_outputs = self.get_ext_outputs()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/bdist_egg.py", line 299, in get_ext_outputs
    for ext in build_cmd.extensions:
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
    raise AttributeError(attr)
AttributeError: extensions
liuxiaozhu01 commented 1 year ago

oh yeah! I dive deep into the error message and i notice that python setup.py install has already been given up, as https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html and i replace the command with pip install . and i finally installed it successfully. Sorry for the disturbance I've caused you through my carelessness. Thanks for your help. Looking forward to seeing your better work in the future :)

jkulhanek commented 1 year ago

Thanks for investigating the issue!