nerfstudio-project / nerfstudio

A collaboration friendly studio for NeRFs
https://docs.nerf.studio
Apache License 2.0
9.18k stars 1.23k forks source link

Problem installing Gsplat and tinnycuda-nn could not find ninja #3313

Open RJ1227 opened 1 month ago

RJ1227 commented 1 month ago

System - AMD Ryzen 7 8845HS Nvidia 4060 GPU Instal VS 2022 with v142 , 2019 C++ Got this error C:\Users\rishu>pip install git+https://github.com/nerfstudio-project/gsplat.git Collecting git+https://github.com/nerfstudio-project/gsplat.git Cloning https://github.com/nerfstudio-project/gsplat.git to c:\users\rishu\appdata\local\temp\pip-req-build-g1yoaxjb Running command git clone --filter=blob:none --quiet https://github.com/nerfstudio-project/gsplat.git 'C:\Users\rishu\AppData\Local\Temp\pip-req-build-g1yoaxjb' Resolved https://github.com/nerfstudio-project/gsplat.git to commit 7562a399b76e1a3283503d14230164f3f0595162 Running command git submodule update --init --recursive -q Preparing metadata (setup.py) ... done Requirement already satisfied: ninja in c:\users\rishu\appdata\roaming\python\python38\site-packages (from gsplat==1.0.0) (1.11.1.1) Requirement already satisfied: numpy in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from gsplat==1.0.0) (1.24.4) Collecting jaxtyping (from gsplat==1.0.0) Using cached jaxtyping-0.2.19-py3-none-any.whl.metadata (5.7 kB) Collecting rich>=12 (from gsplat==1.0.0) Using cached rich-13.7.1-py3-none-any.whl.metadata (18 kB) Requirement already satisfied: torch in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from gsplat==1.0.0) (2.1.2+cu118) Collecting markdown-it-py>=2.2.0 (from rich>=12->gsplat==1.0.0) Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB) Collecting pygments<3.0.0,>=2.13.0 (from rich>=12->gsplat==1.0.0) Using cached pygments-2.18.0-py3-none-any.whl.metadata (2.5 kB) Requirement already satisfied: typing-extensions<5.0,>=4.0.0 in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from rich>=12->gsplat==1.0.0) (4.12.2) Collecting typeguard>=2.13.3 (from jaxtyping->gsplat==1.0.0) Using cached typeguard-4.3.0-py3-none-any.whl.metadata (3.7 kB) Requirement already satisfied: filelock in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from torch->gsplat==1.0.0) (3.15.4) Requirement already satisfied: sympy in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from torch->gsplat==1.0.0) (1.13.0) Requirement already satisfied: networkx in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from torch->gsplat==1.0.0) (3.1) Requirement already satisfied: jinja2 in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from torch->gsplat==1.0.0) (3.1.4) Requirement already satisfied: fsspec in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from torch->gsplat==1.0.0) (2024.6.1) Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=12->gsplat==1.0.0) Using cached mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB) Collecting importlib-metadata>=3.6 (from typeguard>=2.13.3->jaxtyping->gsplat==1.0.0) Using cached importlib_metadata-8.0.0-py3-none-any.whl.metadata (4.6 kB) Requirement already satisfied: MarkupSafe>=2.0 in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from jinja2->torch->gsplat==1.0.0) (2.1.5) Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\users\rishu.conda\envs\nerfstudio\lib\site-packages (from sympy->torch->gsplat==1.0.0) (1.3.0) Collecting zipp>=0.5 (from importlib-metadata>=3.6->typeguard>=2.13.3->jaxtyping->gsplat==1.0.0) Using cached zipp-3.19.2-py3-none-any.whl.metadata (3.6 kB) Using cached rich-13.7.1-py3-none-any.whl (240 kB) Using cached jaxtyping-0.2.19-py3-none-any.whl (24 kB) Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB) Using cached pygments-2.18.0-py3-none-any.whl (1.2 MB) Using cached typeguard-4.3.0-py3-none-any.whl (35 kB) Using cached importlib_metadata-8.0.0-py3-none-any.whl (24 kB) Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB) Using cached zipp-3.19.2-py3-none-any.whl (9.0 kB) Building wheels for collected packages: gsplat Building wheel for gsplat (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [2785 lines of output] Setting MAX_JOBS to 10 running bdist_wheel C:\Users\rishu.conda\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:502: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend. warnings.warn(msg.format('we could not find ninja.')) running build running build_py creating build creating build\lib.win-amd64-cpython-38 creating build\lib.win-amd64-cpython-38\gsplat copying gsplat\relocation.py -> build\lib.win-amd64-cpython-38\gsplat copying gsplat\rendering.py -> build\lib.win-amd64-cpython-38\gsplat copying gsplat\version.py -> build\lib.win-amd64-cpython-38\gsplat copying gsplat_helper.py -> build\lib.win-amd64-cpython-38\gsplat copying gsplat__init.py -> build\lib.win-amd64-cpython-38\gsplat creating build\lib.win-amd64-cpython-38\gsplat\cuda copying gsplat\cuda_backend.py -> build\lib.win-amd64-cpython-38\gsplat\cuda copying gsplat\cuda_torch_impl.py -> build\lib.win-amd64-cpython-38\gsplat\cuda copying gsplat\cuda_wrapper.py -> build\lib.win-amd64-cpython-38\gsplat\cuda copying gsplat\cuda__init__.py -> build\lib.win-amd64-cpython-38\gsplat\cuda creating build\lib.win-amd64-cpython-38\gsplat\cuda_legacy copying gsplat\cuda_legacy_backend.py -> build\lib.win-amd64-cpython-38\gsplat\cuda_legacy copying gsplat\cuda_legacy_torch_impl.py -> build\lib.win-amd64-cpython-38\gsplat\cuda_legacy copying gsplat\cuda_legacy_wrapper.py -> build\lib.win-amd64-cpython-38\gsplat\cuda_legacy copying gsplat\cuda_legacy\init__.py -> build\lib.win-amd64-cpython-38\gsplat\cuda_legacy 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' C:\Users\rishu.conda\envs\nerfstudio\lib\site-packages\setuptools\command\build_py.py:207: _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.
          ********************************************************************************
FXTDwiki commented 1 month ago

I am currently writing a documentation on the installation for Windows. I'm almost at the end of it !

It looks like this message appears if the 4 files of CUDA Toolkit are not present in C:\Program Files\Microsoft Visual Studio\2022[Your Edition]\MSBuild\Microsoft\VC\v160\BuildCustomizations

Maybe you have installed MSVC 142 after the Toolkit like me.

Instructions for Installing CUDA Toolkit with Visual Studio 2022 and Setting Up Environment Variables

  1. Install CUDA Toolkit:

  2. Install CUDA Toolkit:

    • Once downloaded, run the file cuda_11.8.0_522.06_windows.exe.
    • Choose the Express installation option.
  3. Copy Visual Studio Integration Files:

    • After installation, navigate to the following directory:
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\extras\visual_studio_integration\MSBuildExtensions
    • Copy the four files found in the directory.
  4. Paste Files in Visual Studio Directory:

    • Go to the Visual Studio directory:
      C:\Program Files\Microsoft Visual Studio\2022\[Your Edition]\MSBuild\Microsoft\VC\v160\BuildCustomizations
    • Note: Replace [Your Edition] with the version of Visual Studio installed on your computer. This could be one of the following:
      • Community
      • Professional
      • Enterprise
      • BuildTools
    • Verify that the copied files are present in the v160 folder. If not, paste them into the directory.
  5. Modify Visual Studio Installation if Necessary:

    • If the v160 folder does not exist, modify the Visual Studio 2022 installation to include MSVC v142 x64/x86.
  6. Update System Environment Variables:

    • Set CUDA_HOME by copying the value from CUDA_PATH:
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
    • Set HOME to:
      %USERPROFILE%
  7. Add TCNN_CUDA_ARCHITECTURES Variable:

    • Add the environment variable TCNN_CUDA_ARCHITECTURES and set its value according to your GPU type:
    GPU TCNN CUDA Architecture
    H100 90
    40X0 / A6000 Ada 89
    30X0 / A6000 86
    A100 80
    20X0 75
    TITAN V / V100 70
    10X0 / TITAN Xp 61
    9X0 52
    K80 37
    • For example, for a 4070 laptop GPU the value is the same as desktop GPUs: 89.
    • For more information on CUDA GPUs, refer to the CUDA GPUs page.

By following these steps, you will have a properly configured CUDA Toolkit integrated with Visual Studio 2022 and the necessary environment variables set up.

RJ1227 commented 1 month ago

thanks will try this

7yzx commented 1 month ago

@RJ1227 are these work for you? I do but failed

FXTDwiki commented 1 month ago

What error do you have ?

7yzx commented 1 month ago

@FXTDwiki maybe same with above , but my version is cuda11.7 and vs2019. GPU is 1080 . I also try cuda11.8,but failed with another error. the error use cuda 11.7

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

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [2751 lines of output]

      D:\Software\Miniforge3\envs\nerfstudio2\lib\site-packages\torch\utils\cpp_extension.py:359: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
        warnings.warn(f'Error checking compiler version for {compiler}: {error}')
      error: [WinError 2] 系统找不到指定的文件。
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Running setup.py clean for gsplat
Failed to build gsplat
ERROR: Could not build wheels for gsplat, which is required to install pyproject.toml-based projects
FXTDwiki commented 1 month ago

You don't need to install gsplat to install NerfStudio. NerfStudio will uninstall it after! I am finishing the documentation right now. Check your numpy version. It should be a version <2.0 pip install "numpy<2.0"

7yzx commented 1 month ago

@FXTDwiki Thank you so much, I'm going to use it now!