NVlabs / tiny-cuda-nn

Lightning fast C++/CUDA neural network framework
Other
3.74k stars 453 forks source link

Cannot build inside nerfstudio when VS 2022 is installed on Windows #169

Open erich666 opened 2 years ago

erich666 commented 2 years ago

The main problem: tiny-cuda-nn’s setup.py script currently selects the latest visual studio it can find. I don't know how to override this.

I'm trying out nerfstudio, https://github.com/nerfstudio-project/nerfstudio, trying to make it.

I'm at:

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 -f https://download.pytorch.org/whl/torch_stable.html
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

First line worked fine, next one fails. Yes, I have CUDA 11.3 installed. I get:

      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include\crt/host_config.h(160): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
      common.cu
      error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.3\\bin\\nvcc.exe' failed with exit code 2

It's simply trying to use a cl.exe in VS 2022, which this version of CUDA, 11.3, doesn't want to allow.

I also a newer CUDA, 11.7, but nerfstudio says it wants 1.13. Well, pytorch does:

(nerfstudio) C:\Users\Eric\Documents\GitHub\nerfstudio>pip install torch==1.12.1+cu117 torchvision==0.13.1+cu117 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu117 (from versions: 1.4.0, 1.4.0+cpu, 1.4.0+cu92, 1.5.0, 1.5.0+cpu, 1.5.0+cu101, 1.5.0+cu92, 1.5.1, 1.5.1+cpu, 1.5.1+cu101, 1.5.1+cu92, 1.6.0, 1.6.0+cpu, 1.6.0+cu101, 1.7.0, 1.7.0+cpu, 1.7.0+cu101, 1.7.0+cu110, 1.7.1, 1.7.1+cpu, 1.7.1+cu101, 1.7.1+cu110, 1.8.0, 1.8.0+cpu, 1.8.0+cu101, 1.8.0+cu111, 1.8.1, 1.8.1+cpu, 1.8.1+cu101, 1.8.1+cu102, 1.8.1+cu111, 1.9.0, 1.9.0+cpu, 1.9.0+cu102, 1.9.0+cu111, 1.9.1, 1.9.1+cpu, 1.9.1+cu102, 1.9.1+cu111, 1.10.0, 1.10.0+cpu, 1.10.0+cu102, 1.10.0+cu111, 1.10.0+cu113, 1.10.1, 1.10.1+cpu, 1.10.1+cu102, 1.10.1+cu111, 1.10.1+cu113, 1.10.2, 1.10.2+cpu, 1.10.2+cu102, 1.10.2+cu111, 1.10.2+cu113, 1.11.0, 1.11.0+cpu, 1.11.0+cu113, 1.11.0+cu115, 1.12.0, 1.12.0+cpu, 1.12.0+cu113, 1.12.0+cu116, 1.12.1, 1.12.1+cpu, 1.12.1+cu113, 1.12.1+cu116)
ERROR: No matching distribution found for torch==1.12.1+cu117

I tried CUDA 11.6, but that failed, too.

It was suggested to edit bindings/torch/setup.py and manually getting the github repo, i.e., clone tiny cuda nn (make sure to do --recursive) and do cd bindings/torch and then python setup.py install after editing setup.py to point to VS 2019.

I started to look into this option. I could not figure out how setup.py is determining how to use VS 2022. My PATH doesn't seem to have the 2022 path in it, I don't see it in setup.py.

I'm trying to follow nerfstudio's build instructions, but it looks difficult to impossible to do so because I cannot figure out how to force tiny-cuda-nn to use VS 2019. I'm sure an expert could do so; I'm hoping for an option for "the rest of us."

erich666 commented 2 years ago

Full log of nerfstudio fail:

(base) C:\Users\Eric>cd C:\Users\Eric\Documents\GitHub\nerfstudio

(base) C:\Users\Eric\Documents\GitHub\nerfstudio>conda activate nerfstudio

(nerfstudio) C:\Users\Eric\Documents\GitHub\nerfstudio>pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.12.1+cu113
  Downloading https://download.pytorch.org/whl/cu113/torch-1.12.1%2Bcu113-cp38-cp38-win_amd64.whl (2143.5 MB)
     ---------------------------------------- 2.1/2.1 GB 1.7 MB/s eta 0:00:00
Collecting torchvision==0.13.1+cu113
  Downloading https://download.pytorch.org/whl/cu113/torchvision-0.13.1%2Bcu113-cp38-cp38-win_amd64.whl (4.7 MB)
     ---------------------------------------- 4.7/4.7 MB 50.3 MB/s eta 0:00:00
Collecting typing-extensions
  Using cached typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting numpy
  Downloading numpy-1.23.3-cp38-cp38-win_amd64.whl (14.7 MB)
     ---------------------------------------- 14.7/14.7 MB 14.9 MB/s eta 0:00:00
Collecting requests
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting pillow!=8.3.*,>=5.3.0
  Downloading Pillow-9.2.0-cp38-cp38-win_amd64.whl (3.3 MB)
     ---------------------------------------- 3.3/3.3 MB 14.0 MB/s eta 0:00:00
Collecting charset-normalizer<3,>=2
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.4-py3-none-any.whl (61 kB)
     ---------------------------------------- 61.5/61.5 kB 545.7 kB/s eta 0:00:00
Requirement already satisfied: certifi>=2017.4.17 in c:\users\eric\anaconda3\envs\nerfstudio\lib\site-packages (from requests->torchvision==0.13.1+cu113) (2022.9.24)
Installing collected packages: urllib3, typing-extensions, pillow, numpy, idna, charset-normalizer, torch, requests, torchvision
Successfully installed charset-normalizer-2.1.1 idna-3.4 numpy-1.23.3 pillow-9.2.0 requests-2.28.1 torch-1.12.1+cu113 torchvision-0.13.1+cu113 typing-extensions-4.3.0 urllib3-1.26.12

(nerfstudio) C:\Users\Eric\Documents\GitHub\nerfstudio>pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
Collecting git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
  Cloning https://github.com/NVlabs/tiny-cuda-nn/ to c:\users\eric\appdata\local\temp\pip-req-build-33mwchm7
  Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/tiny-cuda-nn/ 'C:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7'
  Resolved https://github.com/NVlabs/tiny-cuda-nn/ to commit 563b626c298a88b5a0c6fb47944c693e9fbd8507
  Running command git submodule update --init --recursive -q
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: tinycudann
  Building wheel for tinycudann (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      Building PyTorch extension for tiny-cuda-nn version 1.6
      Obtained compute capability 75 from PyTorch
      running bdist_wheel
      C:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:411: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-38
      creating build\lib.win-amd64-cpython-38\tinycudann
      copying tinycudann\modules.py -> build\lib.win-amd64-cpython-38\tinycudann
      copying tinycudann\__init__.py -> build\lib.win-amd64-cpython-38\tinycudann
      running egg_info
      creating tinycudann.egg-info
      writing tinycudann.egg-info\PKG-INFO
      writing dependency_links to tinycudann.egg-info\dependency_links.txt
      writing top-level names to tinycudann.egg-info\top_level.txt
      writing manifest file 'tinycudann.egg-info\SOURCES.txt'
      reading manifest file 'tinycudann.egg-info\SOURCES.txt'
      writing manifest file 'tinycudann.egg-info\SOURCES.txt'
      copying tinycudann\bindings.cpp -> build\lib.win-amd64-cpython-38\tinycudann
      running build_ext
      building 'tinycudann_bindings._C' extension
      creating build\dependencies
      creating build\dependencies\fmt
      creating build\dependencies\fmt\src
      creating build\src
      creating build\temp.win-amd64-cpython-38
      creating build\temp.win-amd64-cpython-38\Release
      creating build\temp.win-amd64-cpython-38\Release\tinycudann
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/tools/util/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/fmt/include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\TH -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -IC:\Users\Eric\anaconda3\envs\nerfstudio\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /EHsc /Tp../../dependencies/fmt/src/format.cc /Fobuild\temp.win-amd64-cpython-38\Release\../../dependencies/fmt/src/format.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc /std:c++14 -DTCNN_MIN_GPU_ARCH=75 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0
      format.cc
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/tools/util/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/fmt/include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\TH -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -IC:\Users\Eric\anaconda3\envs\nerfstudio\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /EHsc /Tp../../dependencies/fmt/src/os.cc /Fobuild\temp.win-amd64-cpython-38\Release\../../dependencies/fmt/src/os.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc /std:c++14 -DTCNN_MIN_GPU_ARCH=75 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0
      os.cc
      "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin\nvcc" -c ../../src/common.cu -o build\temp.win-amd64-cpython-38\Release\../../src/common.obj -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/tools/util/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/fmt/include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\TH -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -IC:\Users\Eric\anaconda3\envs\nerfstudio\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -std=c++14 --extended-lambda --expt-relaxed-constexpr -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -DTCNN_MIN_GPU_ARCH=75 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 --use-local-env
      cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF_OPERATORS__' with '/U__CUDA_NO_HALF_OPERATORS__'
      cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF_CONVERSIONS__' with '/U__CUDA_NO_HALF_CONVERSIONS__'
      cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF2_OPERATORS__' with '/U__CUDA_NO_HALF2_OPERATORS__'
      common.cu
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include\crt/host_config.h(160): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
      common.cu
      error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.3\\bin\\nvcc.exe' failed with exit code 2
      [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
Failed to build tinycudann
Installing collected packages: tinycudann
  Running setup.py install for tinycudann ... error
  error: subprocess-exited-with-error

  × Running setup.py install for tinycudann did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]
      Building PyTorch extension for tiny-cuda-nn version 1.6
      Obtained compute capability 75 from PyTorch
      running install
      C:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      running egg_info
      writing tinycudann.egg-info\PKG-INFO
      writing dependency_links to tinycudann.egg-info\dependency_links.txt
      writing top-level names to tinycudann.egg-info\top_level.txt
      C:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:411: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))
      reading manifest file 'tinycudann.egg-info\SOURCES.txt'
      writing manifest file 'tinycudann.egg-info\SOURCES.txt'
      running build_ext
      building 'tinycudann_bindings._C' extension
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/tools/util/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/fmt/include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\TH -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -IC:\Users\Eric\anaconda3\envs\nerfstudio\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /EHsc /Tp../../dependencies/fmt/src/format.cc /Fobuild\temp.win-amd64-cpython-38\Release\../../dependencies/fmt/src/format.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc /std:c++14 -DTCNN_MIN_GPU_ARCH=75 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0
      format.cc
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/tools/util/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/fmt/include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\TH -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -IC:\Users\Eric\anaconda3\envs\nerfstudio\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /EHsc /Tp../../dependencies/fmt/src/os.cc /Fobuild\temp.win-amd64-cpython-38\Release\../../dependencies/fmt/src/os.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc /std:c++14 -DTCNN_MIN_GPU_ARCH=75 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0
      os.cc
      "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin\nvcc" -c ../../src/common.cu -o build\temp.win-amd64-cpython-38\Release\../../src/common.obj -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/cutlass/tools/util/include -IC:\Users\Eric\AppData\Local\Temp\pip-req-build-33mwchm7/dependencies/fmt/include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\TH -IC:\Users\Eric\anaconda3\envs\nerfstudio\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -IC:\Users\Eric\anaconda3\envs\nerfstudio\include -IC:\Users\Eric\anaconda3\envs\nerfstudio\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -std=c++14 --extended-lambda --expt-relaxed-constexpr -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -DTCNN_MIN_GPU_ARCH=75 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 --use-local-env
      cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF_OPERATORS__' with '/U__CUDA_NO_HALF_OPERATORS__'
      cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF_CONVERSIONS__' with '/U__CUDA_NO_HALF_CONVERSIONS__'
      cl : Command line warning D9025 : overriding '/D__CUDA_NO_HALF2_OPERATORS__' with '/U__CUDA_NO_HALF2_OPERATORS__'
      common.cu
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include\crt/host_config.h(160): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
      common.cu
      error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.3\\bin\\nvcc.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> tinycudann

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
3a1b2c3 commented 2 years ago

i have trouble building tinycuda bindings on windows with python 3.7 and 3.8, cuda 11.3 as well. Visual studio 2019 some complications with c14. https://github.com/3a1b2c3/tiny-cuda-nn-windows?organization=3a1b2c3&organization=3a1b2c3 changing 1 flag makes it compile until it hangs for hours on encoding.cu. C++ code /no bindings builds fine for me

yzy1996 commented 2 years ago

Actually,

  1. there is no torch==1.12.1+cu117, you can use any cuda version you want (11.3 is fine).
  2. VS 2022 is fine for me.

Maybe you can try conda install -c conda-forge ninja first.

3a1b2c3 commented 2 years ago

I think its memory now https://github.com/NVlabs/tiny-cuda-nn/issues/175 In the above log 'we could not find ninja.' pip install ninja?

Mrhetsko commented 1 year ago

Same problem

CazCzw commented 1 year ago

Same problem

File "D:\USERNAME\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1824, in _run_ninja_build
          raise RuntimeError(message) from e
      RuntimeError: Error compiling objects for extension
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> tinycudann

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
an303042 commented 1 year ago

Anyone managed to solve this? Can't get past this - cl : Command line warning D9025 : overriding '/DCUDA_NO_HALF_OPERATORS' with '/UCUDA_NO_HALF_OPERATORS' cl : Command line warning D9025 : overriding '/DCUDA_NO_HALF_CONVERSIONS' with '/UCUDA_NO_HALF_CONVERSIONS' cl : Command line warning D9025 : overriding '/DCUDA_NO_HALF2_OPERATORS' with '/UCUDA_NO_HALF2_OPERATORS' common.cu C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include\crt/host_config.h(160): fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. common.cu error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin\nvcc.exe' failed with exit code 2 [end of output]

Mrhetsko commented 1 year ago

I use VS 2019 instead 2022 (+ install desktop development on C++ tools in VS installer) and cuda 11.7 instead 11.3 . After this two changes it was possible run "pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch" without errors on my system

lbj96347 commented 1 year ago

@Mrhetsko hey bro, thanks for your tips. cuda 11.7 + vs 2022 also works on my computer. I tried vs2019 + cuda 11.3 for servral ways but failed.

My environment:

But I didn't use pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch to install tiny-cuda-nn, I run git clone --recursive https://github.com/nvlabs/tiny-cuda-nn and cmake then.

When I tried to run python setup.py install in binding/torch, setup.py shows can't find Visual Studio environment. I replace the default path in setup.py with Visual Studio installation path, it works.

AldeRoberge commented 1 year ago

When installing Visual Studio 2022, make sure you check "C++ Build Tools" and install it BEFORE you install CUDA.

image

eunkiyomi commented 5 months ago

For me, it seems like a problem of _MSC_VER of the latest Visual Studio 2022.

CUDA (in my case, 11.8) requires _MSC_VER < 1910 || _MSC_VER >= 1940, but the new VS 2022 has the value of 1940.

(https://forums.developer.nvidia.com/t/visual-studio-2022-cuda-toolkit-support/197578/17)

Thus, I remove the current installation and reinstall the earlier version of VS 2022 (Fall 2023 LTSC == 17.8).

You can download it from https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#evergreen-bootstrappers

Then I could successfully install using this command as mentioned in NerfStudio document. pip install ninja git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

thomaspingel commented 4 months ago

I was getting the "unsupported Microsoft Visual Studio version" when installing, but similar to eunkiyomi, in Visual Studio Installer for my 2022 install, I went to individual components and checked all the MSVC v143 - VS 2022 C++ x64/x86 build tools on the list, even if out of support. Install of tiny-cuda-nn worked fine after that.