NVlabs / nvdiffrec

Official code for the CVPR 2022 (oral) paper "Extracting Triangular 3D Models, Materials, and Lighting From Images".
Other
2.13k stars 223 forks source link

OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root. Building PyTorch extension for tiny-cuda-nn version 1.7 Obtained compute capabilities [86] from environment variable TCNN_CUDA_ARCHITECTURES Detected CUDA version 11.6 Targeting C++ standard 17 [end of output] #155

Open xgh127 opened 5 months ago

xgh127 commented 5 months ago

I wonder why on Windows:

(dmodel)C:\Users\xgh>pip install --global-option="--no-networks" git+https://github.com/NVlabs/tiny-cuda-nn#subdirectory=bindings/torch
DEPRECATION: --build-option and --global-option are deprecated. pip 24.0 will enforce this behaviour change. A possible replacement is to use --config-settings. Discussion can be found at https://github.com/pypa/pip/issues/11859
WARNING: Implying --no-binary=:all: due to the presence of --build-option / --global-option.
Collecting git+https://github.com/NVlabs/tiny-cuda-nn#subdirectory=bindings/torch
  Cloning https://github.com/NVlabs/tiny-cuda-nn to c:\users\xgh\appdata\local\temp\pip-req-build-f_8qftyt
  Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/tiny-cuda-nn 'C:\Users\xgh\AppData\Local\Temp\pip-req-build-f_8qftyt'
  Resolved https://github.com/NVlabs/tiny-cuda-nn to commit 2ec562e853e6f482b5d09168705205f46358fb39
  Running command git submodule update --init --recursive -q
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      C:\Users\xgh\AppData\Local\Temp\pip-req-build-f_8qftyt\bindings/torch\setup.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
        from pkg_resources import parse_version
      nvcc: NVIDIA (R) Cuda compiler driver
      Copyright (c) 2005-2021 NVIDIA Corporation
      Built on Fri_Dec_17_18:28:54_Pacific_Standard_Time_2021
      Cuda compilation tools, release 11.6, V11.6.55
      Build cuda_11.6.r11.6/compiler.30794723_0
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\xgh\AppData\Local\Temp\pip-req-build-f_8qftyt\bindings/torch\setup.py", line 187, in <module>
          ext_modules = [make_extension(comp) for comp in compute_capabilities]
        File "C:\Users\xgh\AppData\Local\Temp\pip-req-build-f_8qftyt\bindings/torch\setup.py", line 187, in <listcomp>
          ext_modules = [make_extension(comp) for comp in compute_capabilities]
        File "C:\Users\xgh\AppData\Local\Temp\pip-req-build-f_8qftyt\bindings/torch\setup.py", line 172, in make_extension
          ext = CUDAExtension(
        File "C:\Users\xgh\anaconda3\envs\dmodel\lib\site-packages\torch\utils\cpp_extension.py", line 1074, in CUDAExtension
          library_dirs += library_paths(cuda=True)
        File "C:\Users\xgh\anaconda3\envs\dmodel\lib\site-packages\torch\utils\cpp_extension.py", line 1208, in library_paths
          paths.append(_join_cuda_home(lib_dir))
        File "C:\Users\xgh\anaconda3\envs\dmodel\lib\site-packages\torch\utils\cpp_extension.py", line 2407, in _join_cuda_home
          raise OSError('CUDA_HOME environment variable is not set. '
      OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
      Building PyTorch extension for tiny-cuda-nn version 1.7
      Obtained compute capabilities [86] from environment variable TCNN_CUDA_ARCHITECTURES
      Detected CUDA version 11.6
      Targeting C++ standard 17
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I've already set the CUDA_HOME which can be checked by the command below:

(dmodel) C:\Users\xgh>echo %CUDA_PATH%
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6

(dmodel) C:\Users\xgh>echo %CUDA_HOME%
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6

while the one thing that confused me is that when I run :

(dmodel) C:\Users\xgh>nvidia-smi
Thu Apr 18 14:49:00 2024
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 517.00       Driver Version: 517.00       CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|

but the cuda I installed is on my local file is :C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6

God! save me !

jmunkberg commented 5 months ago

From the log, this seems to be an issue with tcnn, so please check there first for advice. https://github.com/NVlabs/tiny-cuda-nn

Also, check the version of Cuda that your installation of PyTorch expects: print(torch.version.cuda)

and make sure that matches the Cuda toolkit you have installed. That the driver uses a newer cuda version (as shown in nvidia-smi) should be fine.