ashawkey / torch-ngp

A pytorch CUDA extension implementation of instant-ngp (sdf and nerf), with a GUI.
MIT License
2.11k stars 275 forks source link

No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1' #173

Closed git2andi closed 1 year ago

git2andi commented 1 year ago

Hello! I am desperately trying to make dreamfusion run locally on windows 11. Everything works as mentioned until bash scripts/install_ext.sh which led to the following error message (all equal for raymarching, shencoder, frequencoder and gridencoder):

andi@andiPC MINGW64 ~/stable-dreamfusion (main)
$ sh scripts/install_ext.sh
Processing c:\users\andi\stable-dreamfusion\raymarching
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: raymarching
  Building wheel for raymarching (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [55 lines of output]
      No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1'
      running bdist_wheel
      running build
      running build_ext
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\andi\stable-dreamfusion\raymarching\setup.py", line 45, in <module>
          setup(
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
          self.run_command(cmd)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
          super().run_command(command)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\wheel\bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
          super().run_command(command)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
          self.run_command(cmd_name)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
          super().run_command(command)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\command\build_ext.py", line 84, in run
          _build_ext.run(self)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 346, in run
          self.build_extensions()
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\torch\utils\cpp_extension.py", line 499, in build_extensions
          _check_cuda_version(compiler_name, compiler_version)
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\torch\utils\cpp_extension.py", line 383, in _check_cuda_version
          torch_cuda_version = packaging.version.parse(torch.version.cuda)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 49, in parse
          return Version(version)
                 ^^^^^^^^^^^^^^^^
        File "C:\Users\andi\venvStableDreamfusion\Lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 264, in __init__
          match = self._regex.search(version)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      TypeError: expected string or bytes-like object, got 'NoneType'
      [end of output]

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

Thus I tried to install everything manually and surprisingly, it worked for raymarching pip install raymarching -> Requirement already satisfied: raymarching in c:\users\andi\venvstabledreamfusion\lib\site-packages (0.1.3)

However, the rest of the packages led to the same above error. or, e.g. using only pip install freqencoder (with no ./) I get: ERROR: Could not find a version that satisfies the requirement freqencoder (from versions: none) ERROR: No matching distribution found for freqencoder What do I have to do to fix that? Is it more of a Windows error or (as I am still a student trying to understand all that PyTorch/CUDA stuff) am I doing something fundamentally wrong? Maybe this is my reason to finally switch to Linux

CUDA and torch seem to work fine, and are recognized. Trying in normal windows cmd or git bash


(venvStableDreamfusion)
andi@andiPC MINGW64 ~/stable-dreamfusion (main) $nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Mon_Apr__3_17:36:15_Pacific_Daylight_Time_2023
Cuda compilation tools, release 12.1, V12.1.105
Build cuda_12.1.r12.1/compiler.32688072_0
(venvStableDreamfusion)
andi@andiPC MINGW64 ~/stable-dreamfusion (main)$ pip show torch
Name: torch
Version: 2.0.1
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: C:\Users\andi\venvStableDreamfusion\Lib\site-packages
Requires: filelock, jinja2, networkx, sympy, typing-extensions
Required-by: accelerate, carvekit-colab, clip, kornia, lpips, pytorch-lightning, taming-transformers-rom1504, timm, torch-ema, torchaudio, torchmetrics, torchvision
(venvStableDreamfusion)```