tiny-cuda-nn icon indicating copy to clipboard operation
tiny-cuda-nn copied to clipboard

ERROR: Failed building wheel for tinycudann

Open Tian-Shu-Huang opened this issue 2 years ago • 12 comments

I got the following error when installing

`/envs/nerfstudio/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 849, in build_extensions build_ext.build_extensions(self) File "/home/tianshu/miniconda3/envs/nerfstudio/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "/home/tianshu/miniconda3/envs/nerfstudio/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "/home/tianshu/miniconda3/envs/nerfstudio/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension _build_ext.build_extension(self, ext) File "/home/tianshu/miniconda3/envs/nerfstudio/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension objects = self.compiler.compile( File "/home/tianshu/miniconda3/envs/nerfstudio/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 662, in unix_wrap_ninja_compile _write_ninja_file_and_compile_objects( File "/home/tianshu/miniconda3/envs/nerfstudio/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1576, in _write_ninja_file_and_compile_objects _run_ninja_build( File "/home/tianshu/miniconda3/envs/nerfstudio/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1919, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension [end of output]

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

my environment is: OS: wsl2 ubuntu22.04 Python 3.10 pytorch 2.1.0.dev20230628+cu121 torch.version.cuda 12.1 cuda 12.1 Can anyone help me fix this issue?

Tian-Shu-Huang avatar Jun 29 '23 03:06 Tian-Shu-Huang

same issue :(

given-dragon avatar Jul 05 '23 06:07 given-dragon

Hi, I changed my cuda tookit version, torch version, python version to the recommended version in the installation section in the website. I successfully fixed this problem. Now, the environment version I have is as follows: python: 3.8.16, GCC 11.2.0, torch 2.0.1+cu118, cuda toolkit cu118 I wish the above message will help you!

Tian-Shu-Huang avatar Jul 07 '23 14:07 Tian-Shu-Huang

For me the message (much further up the stacktrace) states "unsupported GNU version" . Compiling gcc11 takes 4.5 hours usually :/

    132 | #error -- unsupported GNU version! gcc versions later than 11 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, usi

ng an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.

with gcc11 it should be possible todo CXX=g++-11 CC=gcc-11 LD=g++-11 pip install ...

chris-aeviator avatar Aug 16 '23 13:08 chris-aeviator

Hi , I am also getting same error during installation My environment is as below:-

OS: ubuntu20.04 Python 3.8.18 pytorch 1.8.1+cu101 torch.version.cuda 10.1 cuda 10.1

Please let me know if anyone has solution for this problem ?

gaurav00700 avatar Sep 18 '23 21:09 gaurav00700

Hi there,

I've been trying to run the project on WSL and it seems the process is a bit different than on Ubuntu.

If possible, reinstall WSL entirely

  • Start by making sure you have the latest NVDIA driver for your card
  • Then install WSL, set the version to 2:
wsl --set-default-version 2

Then proceed to install Ubuntu 22 using the Microsoft Store.

Check if CUDA is present

If you are using the latest NVIDIA driver, on your Windows, this command should return True right away:

python
import torch
torch.cuda.is_available()
>> True

If not, make sure to read this in detail to make sure you didn't miss a step : https://docs.nvidia.com/cuda/wsl-user-guide/index.html

Make sure that the version of pytorch and cuda are matching what's on the readme:

I have personally used this:

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118

Install the CUDA Toolkit for WSL

Then you need to install the correct version of the CUDA Toolkit (v11.8 - per the command above "cu118") : https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=runfile_local

Which asks you to execute :

wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sudo sh cuda_11.8.0_520.61.05_linux.run

Leave the default options and proceed to installation

Edit environment variables

You then need to edit your ~/.bashrc file, and add :

export PATH=/usr/lib/wsl/lib:$PATH
export PATH=/usr/local/cuda-11.8/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH

Copy the CUDA library for tinycudann to compile

The last step was for me to copy the content of /usr/lib/wsl/lib into /usr/local/cuda-11.8/lib64/ using

sudo cp -r /usr/lib/wsl/lib/* /usr/local/cuda-11.8/lib64/

For some reason tinycudann didn't seem to use /usr/lib/wsl/lib, but the compilation error showed it used -L/usr/local/cuda-11.8/lib64/

Edit: https://github.com/NVlabs/tiny-cuda-nn/issues/183#issuecomment-1342828785 This seems like a better solution regarding this part.

Install dependencies

Only then this worked :

pip install -r requirements.txt 

fabiensabatie avatar Sep 19 '23 17:09 fabiensabatie

For me finally started working, after I updated VS2022.

pzdxatd avatar Sep 27 '23 16:09 pzdxatd

I update my GCC version to 8 and solved this problem.[ https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/

PolyLiYJ avatar Oct 06 '23 11:10 PolyLiYJ

I update my GCC version to 8 and solved this problem.[ https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/

You save my time!

Len-Li avatar Oct 20 '23 11:10 Len-Li

Maybe you can try as this website: https://blog.csdn.net/weixin_45714660/article/details/132027443?spm=1001.2014.3001.5506

Ke-Hao avatar Oct 29 '23 06:10 Ke-Hao

For me, I solved this by switching from "Developer Command Prompt for VS 2022" to "x64 Native Tools Command Prompt for VS 2022". I can't explain why though.

ShaYito avatar Dec 03 '23 04:12 ShaYito

I update my GCC version to 8 and solved this problem.[ https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/

Thank you very much! I'm on Linux Mint 21.2 Cinnamon. I followed the instructions at the link you posted and got my gcc updated to version 11.4 I believe (whatever the latest is at this time). Restarted, continued instructions for NerfStudio install and it successfully installed ninja-1.11.1.1 tinycudann-1.7. This took my machine probably more than 20 minutes. I lost track of time and did other things while it was working. Thanks again, and best wishes!

coby2k avatar Dec 09 '23 05:12 coby2k

when I update my gcc version from 7 to 9, I can solve this problem and successfully install tinycudann

DongChengdongHangZhou avatar Mar 17 '24 13:03 DongChengdongHangZhou