SuLvXiangXin / zipnerf-pytorch

Unofficial implementation of ZipNeRF
Apache License 2.0
783 stars 85 forks source link

Could not locate a supported Microsoft Visual C++ installation #100

Open MbertoldiNormal opened 4 months ago

MbertoldiNormal commented 4 months ago

im trying to install zipnerf on nerfstudio and when i run this command pip install git+https://github.com/SuLvXiangXin/zipnerf-pytorch#subdirectory=extensions/cuda

i get this error : Could not locate a supported Microsoft Visual C++ installation

any clues ?

HungNgoCT commented 4 months ago

Hi,

I have the same problem. When installed using this command: git+https://github.com/SuLvXiangXin/zipnerf-pytorch#subdirectory=extensions/cuda, it requires std=c++17. I installed visual studio 2022, the compiler is c++14. Can anybody help to solve this?

Thank you in advance

jyomu commented 4 months ago
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc --generate-dependencies-with-compile --dependency-output R:\Temp\pip-req-build-69ydt_qb\extensions\cuda\build\temp.win-amd64-cpython-310\Release\Temp\pip-req-build-69ydt_qb\extensions\cuda\src\gridencoder.obj.d -std=c++17 --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /wd4624 -Xcompiler /wd4067 -Xcompiler /wd4068 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -IE:\AI\nerfstudio\.venv\lib\site-packages\torch\include -IE:\AI\nerfstudio\.venv\lib\site-packages\torch\include\torch\csrc\api\include -IE:\AI\nerfstudio\.venv\lib\site-packages\torch\include\TH -IE:\AI\nerfstudio\.venv\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -IE:\AI\nerfstudio\.venv\include -IC:\Users\jyomu\scoop\persist\rye\py\cpython@3.10.13\install\include -IC:\Users\jyomu\scoop\persist\rye\py\cpython@3.10.13\install\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c R:\Temp\pip-req-build-69ydt_qb\extensions\cuda\src\gridencoder.cu -o R:\Temp\pip-req-build-69ydt_qb\extensions\cuda\build\temp.win-amd64-cpython-310\Release\Temp\pip-req-build-69ydt_qb\extensions\cuda\src\gridencoder.obj -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -O3 -std=c++14 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_cuda_backend -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86
      cl : コマンド ライン warning D9025 : '/D__CUDA_NO_HALF_OPERATORS__' より '/U__CUDA_NO_HALF_OPERATORS__' が優先されます。
      cl : コマンド ライン warning D9025 : '/D__CUDA_NO_HALF_CONVERSIONS__' より '/U__CUDA_NO_HALF_CONVERSIONS__' が優先されます。
      cl : コマンド ライン warning D9025 : '/D__CUDA_NO_HALF2_OPERATORS__' より '/U__CUDA_NO_HALF2_OPERATORS__' が優先されます。

      gridencoder.cu

      E:/AI/nerfstudio/.venv/lib/site-packages/torch/include\c10/util/C++17.h(27): fatal error C1189: #error:  You need C++17 to compile PyTorch

      nvcc warning : incompatible redefinition for option 'std', the last value of this option was used

This is my build log, and it seems that the nvcc option had -std=c++14 after -std=c++17, which was overwritten. The last one seems to be applied, so I added the following and the build was successful.

$env:NVCC_APPEND_FLAGS="-std=c++17"
jyomu commented 4 months ago

https://github.com/SuLvXiangXin/zipnerf-pytorch/blob/af86ea6340b9be6b90ea40f66c0c02484dfc7302/extensions/cuda/setup.py#L7-L10 Looks like an if statement is needed here.

koktavy commented 1 week ago

@jyomu Thank you! I hit a "Failed to build cuda_backend" error when trying to get this running within Nerfstudio. This solved it within my conda env:

set NVCC_APPEND_FLAGS=-std=c++17
pip install git+https://github.com/SuLvXiangXin/zipnerf-pytorch#subdirectory=extensions/cuda