gsplat icon indicating copy to clipboard operation
gsplat copied to clipboard

Failed building wheel for gsplat

Open BeyerSEO opened this issue 1 year ago • 12 comments

Hey I want to install gsplat because I want to use nerfstudio on windows 11. When I try to install gsplat (and also tinycuda) I get the error "Failed building wheel".

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: Could not build wheels for gsplat, which is required to install pyproject.toml-based projects

Can someone help me?

BeyerSEO avatar Jun 16 '24 18:06 BeyerSEO

Can u post the full error, the bottom part doesn't say the error.

maturk avatar Jun 16 '24 19:06 maturk

Same issue here. Running CUDA 12.1 with pytorch 12.1 on windows 11 as well. Trying to follow the tutorial from nerfstudio documentation

Here is the console output in attached file. It seems build_ext file doesn't exist.

Command is pip install git+https://github.com/nerfstudio-project/gsplat.git output_log.txt

Out of all the log, the only interesting part seems to be the final ones:

 running build_ext
      error: [WinError 2] The system cannot find the file specified
      [end of output]

~~Maybe there is a stable version/tag we can install from ?~~ Same issue using tag v1.0.0: pip install git+https://github.com/nerfstudio-project/[email protected]

tim-tim707 avatar Jun 17 '24 12:06 tim-tim707

I am not a windows user so it is hard to debug. You can also git clone --recurse-submodules the repo and pip install -e . from there, as a test. Sorry I can't help much since it's probably a windows thing...

maturk avatar Jun 17 '24 12:06 maturk

$ git clone --recurse-submodules https://github.com/nerfstudio-project/gsplat.git $ cd gsplat $ pip install -e .

output_log_git_install.txt

There are deprecation warnings when trying to use setup.py directly. Maybe pip installer shouldn't be used and pypa installer should be used instead ? I have no idea about this other installer though

tim-tim707 avatar Jun 17 '24 13:06 tim-tim707

same question. I tried to follow the installation scheme on the nerfstudio official website and the docs/INSTALL_WIN.md scheme in gslpat, but both failed. Can someone help me?

xuncpp avatar Jun 18 '24 07:06 xuncpp

Here is how I managed to make it work in WSL2, Windows 11:

Install cuda 11.8 from https://forums.developer.nvidia.com/t/installation-of-older-cuda-versions-on-wsl2/259578/3

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda=11.8.0-1

Install miniconda3 from https://docs.anaconda.com/miniconda/

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh

~/miniconda3/bin/conda init bash

Follow the install from https://docs.nerf.studio/quickstart/installation.html

conda create --name nerfstudio -y python=3.8
conda activate nerfstudio
python -m pip install --upgrade pip

pip install torch==2.1.2+cu118 torchvision==0.16.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118

conda install -c "nvidia/label/cuda-11.8.0" cuda-toolkit

If you have a cuda version mismatch with torch here, you should check that nvcc --version has proper release 11.8 Otherwise, you should clean your previous cuda installation and re-install with version 11.8

Install the torch bindings for tiny-cuda-nn

pip install ninja git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

In case of error

/home/user/miniconda3/envs/nerfstudio/compiler_compat/ld: cannot find -lcuda: No such file or directory
      collect2: error: ld returned 1 exit status
      error: command '/usr/bin/g++' failed with exit code 1

you need create a link to the libcuda.so to the previous directory (https://github.com/NVlabs/tiny-cuda-nn/issues/183#issuecomment-1405541078)

ln -s /home/user/miniconda3/envs/nerfstudio/lib/stubs/libcuda.so /home/user/miniconda3/envs/nerfstudio/lib/libcuda.so

Finally

pip install nerfstudio

ns-train should work

Update: I'm running ns-train splatfacto-big colmap --data /mnt/e/mydatadir which is working, CUDA setup didn't cause any issue

tim-tim707 avatar Jun 18 '24 09:06 tim-tim707

On pip install ninja git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch i don't have exit code 1 I have exit code 2.

_HALF2_OPERATORS__ -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -DTCNN_PARAMS_UNALIGNED -DTCNN_MIN_GPU_ARCH=86 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_86_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17 --use-local-env
      clÿ: Ligne de commande warning D9025ÿ: substitution de '/D__CUDA_NO_HALF_OPERATORS__' par '/U__CUDA_NO_HALF_OPERATORS__'
      clÿ: Ligne de commande warning D9025ÿ: substitution de '/D__CUDA_NO_HALF_CONVERSIONS__' par '/U__CUDA_NO_HALF_CONVERSIONS__'
      clÿ: Ligne de commande warning D9025ÿ: substitution de '/D__CUDA_NO_HALF2_OPERATORS__' par '/U__CUDA_NO_HALF2_OPERATORS__'
      common_host.cu
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include\crt/host_config.h(153): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
      common_host.cu
      error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\bin\\nvcc.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tinycudann

Also i don't want to install nerfstudio but gsplat

I have the same exit code 2 when pip install .

I don't have miniconda but anaconda.

I have tried fresh reinstall using --recurse-submodules option, but it doesn't change my error.

softyoda avatar Jun 23 '24 16:06 softyoda

You should ask in the NVLabs/tiny-cuda-nn corresponding github repository for this error since it doesnt seem related to gsplat.

Beside, the error message looks descriptive enough for you to be able to solve it: #error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported!

I'm guessing that if you are using Microsoft Visual Studio you have missed my notice about it working inside WSL2 (ubuntu in this case) and not plain windows cmd or developper shell. You could look into it if changing the Visual Studio version doesnt help

tim-tim707 avatar Jun 23 '24 16:06 tim-tim707

I have microsoft visual studio 2022 community installed, with development for c++ package.

Is WSL2 absolutely must have to run gsplat? (it will require me to re-setup entirely it, and cuda, through commandline without interface, and setup link to my folders, and may be harder to automate to new workflow using python or comfyui if the extent of external decency is such huge)

softyoda avatar Jun 23 '24 16:06 softyoda

Is WSL2 absolutely must have to run gsplat?

I think not but I didn't manage to make it build with windows.

If you manage to make it work please explain how you did it for others in this situation ;)

tim-tim707 avatar Jun 23 '24 16:06 tim-tim707

GPT told me it was ugly and not good, but I still did it :

changed nvcc_flags += ["-O3", "--use_fast_math"]

by nvcc_flags += ["-allow-unsupported-compiler", "-O3", "--use_fast_math"] on line 74 of setup.py

using '-allow-unsupported-compiler' can potentially lead to compilation issues or runtime errors. It's generally recommended to use supported compiler versions when possible.

softyoda avatar Jun 23 '24 21:06 softyoda

Please see this solution here regarding Visual Studio. Give a like if it solves it.

https://github.com/nerfstudio-project/nerfstudio/issues/3157

abrahamezzeddine avatar Jun 25 '24 17:06 abrahamezzeddine

Closing this issue because we now provide prebuilt wheels. Please checkout the latest README

liruilong940607 avatar Sep 27 '24 07:09 liruilong940607