nerfstudio-project / gsplat

CUDA accelerated rasterization of gaussian splatting
https://docs.gsplat.studio/
Apache License 2.0
2.18k stars 274 forks source link

Building from source error #403

Closed luh-j closed 1 month ago

luh-j commented 1 month ago

I'm trying to build gsplat@v1.0.0 from the source as nerfstudio required 1.0.0, and it failed building gsplat. Setup:

  1. nvcc version in conda env:
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2022 NVIDIA Corporation
    Built on Wed_Sep_21_10:33:58_PDT_2022
    Cuda compilation tools, release 11.8, V11.8.89
    Build cuda_11.8.r11.8/compiler.31833905_0
  2. linux ubuntu 22.04
  3. conda env installed as nerfstudio instruction

I've tried to install it with both cmd: pip install -e . and pip install . -- both failed. Simply put, I think the error is

        gsplat/cuda_legacy/csrc/helpers.cuh:2:10: fatal error: third_party/glm/glm/glm.hpp: No such file or directory
            2 | #include "third_party/glm/glm/glm.hpp"
              |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        compilation terminated.```, and for the cmd without e flag it has one more line ```ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (gsplat)

Complete error message: The -e flag errors with

  Running setup.py develop for gsplat
    error: subprocess-exited-with-error

    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [54 lines of output]
        running develop
        running egg_info
        creating gsplat.egg-info
        writing gsplat.egg-info/PKG-INFO
        writing dependency_links to gsplat.egg-info/dependency_links.txt
        writing requirements to gsplat.egg-info/requires.txt
        writing top-level names to gsplat.egg-info/top_level.txt
        writing manifest file 'gsplat.egg-info/SOURCES.txt'
        reading manifest file 'gsplat.egg-info/SOURCES.txt'
        reading manifest template 'MANIFEST.in'
        adding license file 'LICENSE'
        writing manifest file 'gsplat.egg-info/SOURCES.txt'
        running build_ext
        building 'gsplat.csrc_legacy' extension
        creating build
        creating build/temp.linux-x86_64-cpython-38
        creating build/temp.linux-x86_64-cpython-38/gsplat
        creating build/temp.linux-x86_64-cpython-38/gsplat/cuda_legacy
        creating build/temp.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
        /home/xsun90/miniconda3/envs/nerfstudio/bin/nvcc -Igsplat/cuda/csrc -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/TH -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/THC -I/home/xsun90/miniconda3/envs/nerfstudio/include -I/home/xsun90/miniconda3/envs/nerfstudio/include/python3.8 -c gsplat/cuda_legacy/csrc/backward.cu -o build/temp.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc/backward.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -O3 --use_fast_math --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=csrc_legacy -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
        In file included from gsplat/cuda_legacy/csrc/backward.cu:2:
        gsplat/cuda_legacy/csrc/helpers.cuh:2:10: fatal error: third_party/glm/glm/glm.hpp: No such file or directory
            2 | #include "third_party/glm/glm/glm.hpp"
              |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        compilation terminated.
        /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/command/develop.py:41: 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.
                ********************************************************************************

        !!
          easy_install.initialize_options(self)
        /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-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()
        /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no g++ version bounds defined for CUDA version 11.8
          warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
        error: command '/home/xsun90/miniconda3/envs/nerfstudio/bin/nvcc' failed with exit code 1
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  Rolling back uninstall of gsplat
  Moving to /mnt/data1/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/gsplat-1.3.0.dist-info/
   from /mnt/data1/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/~splat-1.3.0.dist-info
  Moving to /mnt/data1/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/gsplat/
   from /mnt/data1/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/~splat
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [54 lines of output]
    running develop
    running egg_info
    creating gsplat.egg-info
    writing gsplat.egg-info/PKG-INFO
    writing dependency_links to gsplat.egg-info/dependency_links.txt
    writing requirements to gsplat.egg-info/requires.txt
    writing top-level names to gsplat.egg-info/top_level.txt
    writing manifest file 'gsplat.egg-info/SOURCES.txt'
    reading manifest file 'gsplat.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    adding license file 'LICENSE'
    writing manifest file 'gsplat.egg-info/SOURCES.txt'
    running build_ext
    building 'gsplat.csrc_legacy' extension
    creating build
    creating build/temp.linux-x86_64-cpython-38
    creating build/temp.linux-x86_64-cpython-38/gsplat
    creating build/temp.linux-x86_64-cpython-38/gsplat/cuda_legacy
    creating build/temp.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
    /home/xsun90/miniconda3/envs/nerfstudio/bin/nvcc -Igsplat/cuda/csrc -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/TH -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/THC -I/home/xsun90/miniconda3/envs/nerfstudio/include -I/home/xsun90/miniconda3/envs/nerfstudio/include/python3.8 -c gsplat/cuda_legacy/csrc/backward.cu -o build/temp.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc/backward.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -O3 --use_fast_math --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=csrc_legacy -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
    In file included from gsplat/cuda_legacy/csrc/backward.cu:2:
    gsplat/cuda_legacy/csrc/helpers.cuh:2:10: fatal error: third_party/glm/glm/glm.hpp: No such file or directory
        2 | #include "third_party/glm/glm/glm.hpp"
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/command/develop.py:41: 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.
            ********************************************************************************

    !!
      easy_install.initialize_options(self)
    /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-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()
    /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no g++ version bounds defined for CUDA version 11.8
      warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
    error: command '/home/xsun90/miniconda3/envs/nerfstudio/bin/nvcc' failed with exit code 1
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

And the error message for the cmd without e flag is here:

Building wheel for gsplat (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [141 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/gsplat
      copying gsplat/__init__.py -> build/lib.linux-x86_64-cpython-38/gsplat
      copying gsplat/_helper.py -> build/lib.linux-x86_64-cpython-38/gsplat
      copying gsplat/rendering.py -> build/lib.linux-x86_64-cpython-38/gsplat
      copying gsplat/version.py -> build/lib.linux-x86_64-cpython-38/gsplat
      creating build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy
      copying gsplat/cuda_legacy/_wrapper.py -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy
      copying gsplat/cuda_legacy/_torch_impl.py -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy
      copying gsplat/cuda_legacy/__init__.py -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy
      copying gsplat/cuda_legacy/_backend.py -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy
      creating build/lib.linux-x86_64-cpython-38/gsplat/cuda
      copying gsplat/cuda/_wrapper.py -> build/lib.linux-x86_64-cpython-38/gsplat/cuda
      copying gsplat/cuda/_torch_impl.py -> build/lib.linux-x86_64-cpython-38/gsplat/cuda
      copying gsplat/cuda/__init__.py -> build/lib.linux-x86_64-cpython-38/gsplat/cuda
      copying gsplat/cuda/_backend.py -> build/lib.linux-x86_64-cpython-38/gsplat/cuda
      running egg_info
      writing gsplat.egg-info/PKG-INFO
      writing dependency_links to gsplat.egg-info/dependency_links.txt
      writing requirements to gsplat.egg-info/requires.txt
      writing top-level names to gsplat.egg-info/top_level.txt
      reading manifest file 'gsplat.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'gsplat.egg-info/SOURCES.txt'
      /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/command/build_py.py:218: _Warning: Package 'gsplat.cuda.csrc' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'gsplat.cuda.csrc' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'gsplat.cuda.csrc' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'gsplat.cuda.csrc' to be distributed and are
              already explicitly excluding 'gsplat.cuda.csrc' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/setuptools/command/build_py.py:218: _Warning: Package 'gsplat.cuda_legacy.csrc' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'gsplat.cuda_legacy.csrc' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'gsplat.cuda_legacy.csrc' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'gsplat.cuda_legacy.csrc' to be distributed and are
              already explicitly excluding 'gsplat.cuda_legacy.csrc' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      creating build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/CMakeLists.txt -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/backward.cu -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/backward.cuh -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/bindings.cu -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/bindings.h -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/config.h -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/ext.cpp -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/forward.cu -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/forward.cuh -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/helpers.cuh -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      copying gsplat/cuda_legacy/csrc/sh.cuh -> build/lib.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc
      creating build/lib.linux-x86_64-cpython-38/gsplat/cuda/csrc
      copying gsplat/cuda/csrc/bindings.h -> build/lib.linux-x86_64-cpython-38/gsplat/cuda/csrc
      copying gsplat/cuda/csrc/ext.cpp -> build/lib.linux-x86_64-cpython-38/gsplat/cuda/csrc
      copying gsplat/cuda/csrc/helpers.cuh -> build/lib.linux-x86_64-cpython-38/gsplat/cuda/csrc
      copying gsplat/cuda/csrc/projection.cu -> build/lib.linux-x86_64-cpython-38/gsplat/cuda/csrc
      copying gsplat/cuda/csrc/rasterization.cu -> build/lib.linux-x86_64-cpython-38/gsplat/cuda/csrc
      copying gsplat/cuda/csrc/sh.cu -> build/lib.linux-x86_64-cpython-38/gsplat/cuda/csrc
      copying gsplat/cuda/csrc/utils.cuh -> build/lib.linux-x86_64-cpython-38/gsplat/cuda/csrc
      running build_ext
      /home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no g++ version bounds defined for CUDA version 11.8
        warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
      building 'gsplat.csrc_legacy' extension
      /home/xsun90/miniconda3/envs/nerfstudio/bin/nvcc -Igsplat/cuda/csrc -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/TH -I/home/xsun90/miniconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/include/THC -I/home/xsun90/miniconda3/envs/nerfstudio/include -I/home/xsun90/miniconda3/envs/nerfstudio/include/python3.8 -c gsplat/cuda_legacy/csrc/backward.cu -o build/temp.linux-x86_64-cpython-38/gsplat/cuda_legacy/csrc/backward.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -O3 --use_fast_math --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=csrc_legacy -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      In file included from gsplat/cuda_legacy/csrc/backward.cu:2:
      gsplat/cuda_legacy/csrc/helpers.cuh:2:10: fatal error: third_party/glm/glm/glm.hpp: No such file or directory
          2 | #include "third_party/glm/glm/glm.hpp"
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/home/xsun90/miniconda3/envs/nerfstudio/bin/nvcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for gsplat
  Running setup.py clean for gsplat
Failed to build gsplat
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (gsplat)
jckhng commented 1 month ago

Looks like glm is not checked out in the correct folder. You can try to git clone with --recursive to get glm project checked out together with your gsplat project. Then try to build from source. git clone https://github.com/nerfstudio-project/gsplat.git --recursive

npurson commented 1 month ago

Looks like glm is not checked out in the correct folder. You can try to git clone with --recursive to get glm project checked out together with your gsplat project. Then try to build from source. git clone https://github.com/nerfstudio-project/gsplat.git --recursive

Thanks, it works for me! However, I believe that following the current documentation using pip install git+xxx could lead to this issue. Should the documentation be updated to reflect this?

liruilong940607 commented 1 month ago

I believe pip install git+xxx would checkout the repo recursively so it should not be a problem.

I'm closing this issue as it seems to be solved.