tiny-cuda-nn
tiny-cuda-nn copied to clipboard
Pytorch extension fails to install on WSL Ubuntu 20.04, Cuda 11.3/11.6
I'm trying to setup ngp_pl (https://github.com/kwea123/ngp_pl) on a Win11 system, using WSL and Ubuntu 20.04.
I'm using a RTX 4080.
I install WSL, Ubuntu and the CUDA 11.3 WSL drivers following nvidia instructions here, and verify it works: https://docs.nvidia.com/cuda/wsl-user-guide/index.html
I install Anaconda for WSL and that works fine too, and setup a virtual environment.
I install PyTorch 1.12.1 with CUDA 11.3 using this command: pip3 install torch==1.12.1 torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
Before trying to install tiny-cuda-nn, I run these two commands: export TCNN_CUDA_ARCHITECTURES=86 (otherwise it complains about 89 architecture) export PATH=/usr/local/cuda/bin:$PATH (or it may fail because of missing references in this folder.
I clone this tiny-cuda-nn repo, drop into the bindings/torch directory, and run 'python setup.py install'.
It fails with this error in the last line: g++ -pthread -B /home/shaun/anaconda3/envs/ngp_pl/compiler_compat -Wl,--sysroot=/ -pthread -shared -B /home/shaun/anaconda3/envs/ngp_pl/compiler_compat -L/home/shaun/anaconda3/envs/ngp_pl/lib -Wl,-rpath=/home/shaun/anaconda3/envs/ngp_pl/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-38/../../dependencies/fmt/src/format.o build/temp.linux-x86_64-cpython-38/../../dependencies/fmt/src/os.o build/temp.linux-x86_64-cpython-38/../../src/common.o build/temp.linux-x86_64-cpython-38/../../src/common_device.o build/temp.linux-x86_64-cpython-38/../../src/cpp_api.o build/temp.linux-x86_64-cpython-38/../../src/cutlass_mlp.o build/temp.linux-x86_64-cpython-38/../../src/encoding.o build/temp.linux-x86_64-cpython-38/../../src/fully_fused_mlp.o build/temp.linux-x86_64-cpython-38/../../src/network.o build/temp.linux-x86_64-cpython-38/tinycudann/bindings.o -L/home/shaun/anaconda3/envs/ngp_pl/lib/python3.8/site-packages/torch/lib -L/usr/local/cuda/lib64 -lcuda -lcudadevrt -lcudart_static -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda_cu -ltorch_cuda_cpp -o build/lib.linux-x86_64-cpython-38/tinycudann_bindings/_86_C.cpython-38-x86_64-linux-gnu.so /home/shaun/anaconda3/envs/ngp_pl/compiler_compat/ld: cannot find -lcuda: No such file or directory
I tried replacing -lcuda with -L/usr/local/cuda and that seemed to fix this single instance, but I don't know how to fix this globally to let the script complete. Any suggestions?
I also tried this process with Cuda 11.6 and ran into the same issue. I also tried using PIP instead of Anaconda, same issue.
I was able to get this to work by cd'ing to the /usr/local/cuda/lib64
directory and symbolically linking this library to the expected location. Not sure why this script is unable to find it though.
sudo ln -s stubs/libcuda.so libcuda.so
Thank you! your guide saved me!
And I'll list up my specs: Win11+WSL2+ubuntu22.04.2 distro 13700kf + RTX 4090 cuda11.7 pytorch 11.3+cuda11.7 toolkit installed by anaconda
I was able to get this to work by cd'ing to the
/usr/local/cuda/lib64
directory and symbolically linking this library to the expected location. Not sure why this script is unable to find it though.sudo ln -s stubs/libcuda.so libcuda.so
Hi, does it also work for you if you only use
libraries=["cudart"],
?
I was able to get this to work by cd'ing to the
/usr/local/cuda/lib64
directory and symbolically linking this library to the expected location. Not sure why this script is unable to find it though.sudo ln -s stubs/libcuda.so libcuda.so
sudo ln -s /usr/lib/wsl/lib/libcuda.so libcuda.so
works for me.
I was able to get this to work by cd'ing to the
/usr/local/cuda/lib64
directory and symbolically linking this library to the expected location. Not sure why this script is unable to find it though.
sudo ln -s stubs/libcuda.so libcuda.so
Thank god, this workaround save me too~
you know what? I don't know exactly where my settings worked, anyway, after I made some settings, I used the author's recommended 'pip install git'+ https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
”It was unexpectedly installed successfully. I recalled these actions:
① reinstalling cudatoolkit11.8,
② using the sudo ln - s/usr/lib/wsl/lib/libcuda.so libcuda.so
command,
seems to be the most important of these two changes? Then the installation was successful.
this solution works for me https://github.com/NVlabs/tiny-cuda-nn/issues/183#issuecomment-1342828785
Doing this somewhere along the line worked for me:
export LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$LIBRARY_PATH