Open akshay-krishnan opened 1 year ago
have you solved this problem?
Yes, it could have been specific to my environment setup (or to my cuda version 11.3). I had to manually link to the libcuda.so
in my conda environment lib.
@akshay-krishnan How to link libcuda.so ? could you say more details about this solution. I still have this problem.
@akshay-krishnan How did you manually linked libcuda.so?
Sorry for the late response folks.
There was a libcuda.so in this path on my system /lib/x86_64-linux-gnu/libcuda.so
, but I think that path is not included in LD's library path.
I saw that the linked library path in my command is the /lib folder in my conda environment (miniconda3/envs/<env_name>/lib/libcuda.so
). So I linked the libcuda.so from /lib/x86_64-linux-gnu
to this folder with the following command:
ln -s /usr/lib/x86_64-linux-gnu/libcuda.so miniconda3/envs/<env_path>/lib/libcuda.so
I don't know if that is the right libcuda.so to be linked, but installation completed and I was able to import the tinycudann module.
So I tried replicating this in a new environment, and the fix does not work for me anymore. Its not able to find lcuda even though I have a symlink to libcuda.so in the lib folder that it is searching in.
@Tom94 any help here would be great!
I also tried with cuda 11.7, but I face the same problem, so this is probably not version-specific.
I was able to resolve my issue regarding -lcuda
which couldn't be found by following @akshay-krishnan's symlink-solution
Add the following line to your .bashrc
or .zshrc
(depending on your shell) should solve the problem:
export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
The answer from @akshay-krishnan worked for me also,
ln -s /usr/lib/x86_64-linux-gnu/libcuda.so anaconda3/envs/nerfstudio/lib/libcuda.so
and not,
export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
It seems there is no clear-cut solution to this problem, right now.
Add the following line to your
.bashrc
or.zshrc
(depending on your shell) should solve the problem:export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
@yenchenlin I'm able to install
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
After setting the path to /usr/local/cuda/lib64/stubs, thank you!
However, when I tried to run instant-NGP under nerfstudio I have this error:
FAILED: nerfacc_cuda.so
c++ pybind.cuda.o render_weight.cuda.o pack.cuda.o cdf.cuda.o render_transmittance.cuda.o intersection.cuda.o render_transmittance_cub.cuda.o contraction.cuda.o ray_marching.cuda.o -shared -L/home/user/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/lib -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda_cu -ltorch_cuda_cpp -ltorch -ltorch_python -L/home/user/anaconda3/envs/nerfstudio/lib64 -lcudart -o nerfacc_cuda.so
/usr/bin/ld: cannot find -lcudart: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
I tried
export LIBRARY_PATH="/usr/local/cuda/lib64:$LIBRARY_PATH"
since I do found libcudart.so under /usr/local/cuda/lib64 but it does not resolve the issue. Any suggestions? Thank you very much!
@KamiCalcium I'm afraid that's an issue on NerfAcc's side, not tcnn.
That said, if you would like to reproduce instant-ngp's results, I'd warmly encourage using the official implementation as none of the third party re-implementations I've tried match the performance vs. quality tradeoff.
I've solved lcuda not found issue, on WSL2
by executing ln -s /usr/lib/wsl/lib/libcuda.so ~/anaconda3/envs/(your env)/lib/libcuda.so
may be helpful to someone.
I had the same problem installing it in a conda env on WSL. Here is how I solved it.
the compiler tries to find libcuda.so
in ~/miniconda3/envs/(envname)/lib
, but for some reason CUDA installed it to~/miniconda3/envs/(envname)/lib/stubs
so I just created a link for libcuda.so
outside the/stubs
folder byln -s ~/miniconda3/envs/(envname/lib/stubs/libcuda.so ~/miniconda3/envs/xrnerf/lib/libcuda.so
Then it compiled with no error.
I hope it helps.
Add the following line to your
.bashrc
or.zshrc
(depending on your shell) should solve the problem:export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
Just to record, this method also works for WSL2 (Ubuntu 20.02 LTS)
I meet the same problem and solve it with
ln -s /usr/lib/x86_64-linux-gnu/libcuda.so miniconda3/envs/<env_path>/lib/libcuda.so
Note that the libcuda.so must from the Nvidia Driver Lib, not Cuda Lib
Nvidia Driver Lib:
Cuda lib:
Good luck!
Add the following line to your
.bashrc
or.zshrc
(depending on your shell) should solve the problem:export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
Just to record, this method also works for WSL2 (Ubuntu 20.02 LTS)
This also worked on WSL2 Ubuntu 22.04.02, cuda 11.8 with cudnn, Python 3.10 via pip
Add the following line to your
.bashrc
or.zshrc
(depending on your shell) should solve the problem:export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
It works perfectly! thx!
The LIBRARY_PATH
solution did not work for me, but export LDFLAGS=-L/usr/local/cuda/lib64/stub
did.
I tried with @Zazexy and @samsartor's method:
export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
export LDFLAGS=-L/usr/local/cuda/lib64/stub
and it works for me, thank you! specs: RTX4070ti, windows11, cuda11.8, gcc 11 and pytorch 2.0.1
I can confirm the above solution works, though there seems to be a typo (second line should be export LDFLAGS=-L/usr/local/cuda/lib64/stubs
, with an 's' for stubs
).
On CUDA 11.8, PyTorch 2.0, GCC11 (all within an conda env).
Many thanks, and I hope this is fixed soon.
EDIT: Unfortunately, it is still broken. When I try to run it, I get an undefined symbol: _ZN3c104cuda9SetDeviceEi
error.
The
LIBRARY_PATH
solution did not work for me, butexport LDFLAGS=-L/usr/local/cuda/lib64/stub
did.
This works for me, thanks!
I had the same problem installing it in a conda env on WSL. Here is how I solved it.
the compiler tries to find
libcuda.so
in~/miniconda3/envs/(envname)/lib
, but for some reason CUDA installed it to~/miniconda3/envs/(envname)/lib/stubs
so I just created a link for
libcuda.so
outside the/stubs
folder byln -s ~/miniconda3/envs/(envname/lib/stubs/libcuda.so ~/miniconda3/envs/xrnerf/lib/libcuda.so
Then it compiled with no error.
I hope it helps.
Great! It's the problem.
You could also run export LIBRARY_PATH=".../conda/envs/env_name/lib/stubs/:$LIBRARY_PATH"
.
Replace the path to yours
It works for me. Thanks.
Add the following line to your
.bashrc
or.zshrc
(depending on your shell) should solve the problem:export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
@yenchenlin I'm able to install
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
After setting the path to /usr/local/cuda/lib64/stubs, thank you!
However, when I tried to run instant-NGP under nerfstudio I have this error:
FAILED: nerfacc_cuda.so c++ pybind.cuda.o render_weight.cuda.o pack.cuda.o cdf.cuda.o render_transmittance.cuda.o intersection.cuda.o render_transmittance_cub.cuda.o contraction.cuda.o ray_marching.cuda.o -shared -L/home/user/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/torch/lib -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda_cu -ltorch_cuda_cpp -ltorch -ltorch_python -L/home/user/anaconda3/envs/nerfstudio/lib64 -lcudart -o nerfacc_cuda.so /usr/bin/ld: cannot find -lcudart: No such file or directory collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
I tried
export LIBRARY_PATH="/usr/local/cuda/lib64:$LIBRARY_PATH"
since I do found libcudart.so under /usr/local/cuda/lib64 but it does not resolve the issue. Any suggestions? Thank you very much!
Did you find a solution to this Nerfacc related problem?
Add the following line to your
.bashrc
or.zshrc
(depending on your shell) should solve the problem:export LIBRARY_PATH="/usr/local/cuda/lib64/stubs:$LIBRARY_PATH"
Thanks so much. This works and solved my problem.
The
LIBRARY_PATH
solution did not work for me, butexport LDFLAGS=-L/usr/local/cuda/lib64/stub
did.This works for me, thanks!
LDFLAGS works for me!! Thanks!!
Sorry for the late response folks.
There was a libcuda.so in this path on my system
/lib/x86_64-linux-gnu/libcuda.so
, but I think that path is not included in LD's library path. I saw that the linked library path in my command is the /lib folder in my conda environment (miniconda3/envs/<env_name>/lib/libcuda.so
). So I linked the libcuda.so from/lib/x86_64-linux-gnu
to this folder with the following command:ln -s /usr/lib/x86_64-linux-gnu/libcuda.so miniconda3/envs/<env_path>/lib/libcuda.so
I don't know if that is the right libcuda.so to be linked, but installation completed and I was able to import the tinycudann module.
this works, and if there's no libcuda.so in /usr/lib/x86_64-linux-gnu/, you can symlink one using libcuda.so.1 or something like that by
ln -s libcuda.so.1 libcuda.so
export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib/wsl/lib
This works for me.
I am trying to build the pytorch bindings, but I am unable to because lcuda was not found on my system.
ld: cannot find -lcuda
I have cuda installed in/usr/local/cuda-11.3
and added/usr/local/cuda-11.3/bin
to my$PATH
and/usr/local/cuda-11.3/lib64/
to my$LD_LIBRARY_PATH
.I am able to build the library itself with cmake, but no success with the torch bindings. The g++ command fails since it is unable to find lcuda. I also cannot find a libcuda.so in my
/usr/local/cuda-11.3/lib64/
. I found one in/usr/local/cuda-11.3/lib64/stubs/
, and added this path to my LD_LIBRARY_PATH, but that did not help.I appreciate any help on this.