threestudio-project / threestudio

A unified framework for 3D content generation.
Apache License 2.0
6.17k stars 475 forks source link

How to solve when Building wheel for tinycudann output "compiler_compat/ld: cannot find -lcuda: No such file or directory" #405

Closed omanhom closed 8 months ago

omanhom commented 8 months ago

PS C:\Windows\system32> wsl --list 适用于 Linux 的 Windows 子系统分发: Ubuntu-20.04 (默认) PS C:\Windows\system32> wsl --status 默认分发: Ubuntu-20.04 默认版本: 2

gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

一、Install CUDA Toolkit sudo apt-key del 7fa2af80 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

二、 ~/.bashrc add export PATH="/usr/local/cuda-11.8/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH"

三、Install threestudio git clone https://github.com/threestudio-project/threestudio.git cd threestudio/ conda create -n threestudio python=3.10 conda activate threestudio pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 pip install ninja pip install -r requirements.txt

四、Building error info creating build/lib.linux-x86_64-cpython-310/tinycudann_bindings g++ -pthread -B /home/tom/miniconda3/envs/threestudio/compiler_compat -shared -Wl,-rpath,/home/tom/miniconda3/envs/threestudio/lib -Wl,-rpath-link,/home/tom/miniconda3/envs/threestudio/lib -L/home/tom/miniconda3/envs/threestudio/lib -Wl,-rpath,/home/tom/miniconda3/envs/threestudio/lib -Wl,-rpath-link,/home/tom/miniconda3/envs/threestudio/lib -L/home/tom/miniconda3/envs/threestudio/lib /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../dependencies/fmt/src/format.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../dependencies/fmt/src/os.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../src/common_host.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../src/cpp_api.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../src/cutlass_mlp.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../src/encoding.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../src/fully_fused_mlp.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../src/network.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/../../src/object.o /tmp/pip-req-build-8gb3dt_y/bindings/torch/build/temp.linux-x86_64-cpython-310/tinycudann/bindings.o -L/home/tom/miniconda3/envs/threestudio/lib/python3.10/site-packages/torch/lib -L/usr/local/cuda/lib64 -lcuda -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda -o build/lib.linux-x86_64-cpython-310/tinycudann_bindings/_86_C.cpython-310-x86_64-linux-gnu.so /home/tom/miniconda3/envs/threestudio/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 [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 Building wheel for nvdiffrast (setup.py) ... done Created wheel for nvdiffrast: filename=nvdiffrast-0.3.1-py3-none-any.whl size=137845 sha256=8a59392164ecf4fc69d5377caf33f04bd028b58a6aa747bccb3a743b296bda38 Stored in directory: /tmp/pip-ephem-wheel-cache-3e7rzf2o/wheels/24/2b/98/f611ce0d4062793b78daf724e6b47ee800c9a2d3e1ff4b06fa Building wheel for pysdf (setup.py) ... done Created wheel for pysdf: filename=pysdf-0.1.9-cp310-cp310-linux_x86_64.whl size=162169 sha256=a37be5be43cda22387b0a140066f1bf3af5bd692af935d1eb6208d42727dc136 Stored in directory: /home/tom/.cache/pip/wheels/6b/eb/86/4deb6962c13ec72906c6eb13958e84d3c45405e106bf754198 Building wheel for envlight (setup.py) ... done Created wheel for envlight: filename=envlight-0.1.0-py3-none-any.whl size=39747 sha256=c03641485351603e4f709504d18c1f3916dc612a808085ac1018b28538720c83 Stored in directory: /tmp/pip-ephem-wheel-cache-3e7rzf2o/wheels/c8/03/70/2579ccfef7bef64158f69ebc5e12de9b560ef319dfe948e55a Building wheel for clip (setup.py) ... done Created wheel for clip: filename=clip-1.0-py3-none-any.whl size=1369497 sha256=8ca74404285f9330b6be98fdc944d109a59c2883f85726a7156c29952820c016 Stored in directory: /tmp/pip-ephem-wheel-cache-3e7rzf2o/wheels/da/2b/4c/d6691fa9597aac8bb85d2ac13b112deb897d5b50f5ad9a37e4 Building wheel for controlnet_aux (setup.py) ... done Created wheel for controlnet_aux: filename=controlnet_aux-0.0.7-py3-none-any.whl size=274341 sha256=4a6e46b396f534841611f6d4549e6401181438c846ae2b27a886d99d8006327b Stored in directory: /home/tom/.cache/pip/wheels/36/c3/94/8baf044d5b794180b04961a28c5e740b73fab5688a97f1898c Building wheel for ffmpy (setup.py) ... done Created wheel for ffmpy: filename=ffmpy-0.3.1-py3-none-any.whl size=5579 sha256=00345c2ebeaea7526c2355b745b9d5bb80b0bb1ef24847aae1445a365d941f2f Stored in directory: /home/tom/.cache/pip/wheels/fc/1d/38/32e2e8ed0ec76090fa0af8667b849507480cc0c63fa1b69e36 Building wheel for pycollada (setup.py) ... done Created wheel for pycollada: filename=pycollada-0.7.2-py3-none-any.whl size=127016 sha256=a6e548a9abc1fc5705b3676daf9df5d83fc5c7dd55f16cf791e5282ab8db473c Stored in directory: /home/tom/.cache/pip/wheels/dc/f1/5b/53e7cb82940ed37dbd0fa8ad16155bbc6f2d7e54f7144fb7db Successfully built antlr4-python3-runtime nerfacc nvdiffrast pysdf envlight clip controlnet_aux ffmpy pycollada Failed to build tinycudann ERROR: Could not build wheels for tinycudann, which is required to install pyproject.toml-based projects

omanhom commented 8 months ago

I've solved this issue ~/.bashrc add: export LIBRARY_PATH="/usr/local/cuda-11.8/lib64/stubs:$LIBRARY_PATH"

may be helpful to somebody.