NVlabs / tiny-cuda-nn

Lightning fast C++/CUDA neural network framework
Other
3.7k stars 452 forks source link

Can't install "tiny cuda nn" - host_config.h(231): fatal error C1083: Cannot open include file: 'crtdefs.h': No such file or directory #280

Open avrum opened 1 year ago

avrum commented 1 year ago

Describe the bug Getting the following error when trying to run

pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

Produce the following output:

 error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [163 lines of output]

...

FAILED: C:/Users/Asus ws 422/AppData/Local/Temp/pip-req-build-w8vivfm6/bindings/torch/build/dependencies/fmt/src/os.obj

fatal error C1083: Cannot open include file: 'cerrno': No such file or directory

C:\Users\Asus422\AppData\Local\Temp\pip-req-build-w8vivfm6/dependencies/fmt/include\fmt/format-inl.h(11): fatal error C1083: Cannot open include file: 'algorithm': No such file or directory

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_device.cu

      E:\Program Files\CUDA\v11.7\include\crt/host_config.h(231): fatal error C1083: Cannot open include file: 'crtdefs.h': No such file or directory

Any thought how to handle it?

My system Info: Windows 10 Visual Studio 2022 CUDA 11.7

Eric-Ho-Matrix commented 1 year ago

I meet the same problem. And my sys info is : Win 10 VS 2019 CUDA 11.3

zhanghongyong123456 commented 1 year ago

I meet the same problem. And my sys info is : Win 10 VS 2019 CUDA 11.3

i have same error,can you help me

davidebaltieri31 commented 1 year ago

Had the same issue, it's mostly related to Visual Studio not setting up environment variable during install. Before installing tiny-cuda-nn, in the same anaconda command prompt windows run vcvars64.bat (usually it's in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build) which sets VC env vars correctly. Then proceed to install tiny-cuda-nn (with pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch as described in the readme)

Also check of you have ninja installed somewhere, (in the command prompt use "where ninja" to check if you it can be found) it gave me problem with tiny-cuda-nn as it defaults to it if it's found, I removed it from my path and all was fine.

emojilearning commented 1 year ago

I tried method above and didn't work. Then I change powershell to cmd and it works :)

juneleung commented 1 year ago

Had the same issue, it's mostly related to Visual Studio not setting up environment variable during install. Before installing tiny-cuda-nn, in the same anaconda command prompt windows run vcvars64.bat (usually it's in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build) which sets VC env vars correctly. Then proceed to install tiny-cuda-nn (with pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch as described in the readme)

Thanks! It works for me !!

murcje commented 1 year ago

@davidebaltieri31 thx, worked for me too!

jackdaus commented 9 months ago

Thanks, this worked for me! I was getting the same error message about the "algorithm" file not being found.

@davidebaltieri31 Had the same issue, it's mostly related to Visual Studio not setting up environment variable during install. Before installing tiny-cuda-nn, in the same anaconda command prompt windows run vcvars64.bat (usually it's in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build) which sets VC env vars correctly. Then proceed to install tiny-cuda-nn (with pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch as described in the readme)

Also check of you have ninja installed somewhere, (in the command prompt use "where ninja" to check if you it can be found) it gave me problem with tiny-cuda-nn as it defaults to it if it's found, I removed it from my path and all was fine.

Just to make these steps clearer for others, to fix the issue:

  1. From INSIDE the activated conda environment, run the vcvars64.bat script to set up the environment variables. For example, I have activated my conda environment (nerfstudio) and then I run the .bat file from Visual Studio 2022, (nerfstudio) C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build>vcvars64.bat
  2. Now, the install should work! (nerfstudio) pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

Notes:

caihua commented 7 months ago

Had the same issue, it's mostly related to Visual Studio not setting up environment variable during install. Before installing tiny-cuda-nn, in the same anaconda command prompt windows run vcvars64.bat (usually it's in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build) which sets VC env vars correctly. Then proceed to install tiny-cuda-nn (with pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch as described in the readme)

Also check of you have ninja installed somewhere, (in the command prompt use "where ninja" to check if you it can be found) it gave me problem with tiny-cuda-nn as it defaults to it if it's found, I removed it from my path and all was fine.

Note there is two program in anaconda, is "Anaconda Prompt " and "Anaconda PowerShell Prompt", powershell can't use bat file or I don't know how to use vcvars64.bat, so when I try no powershell Prompt, it works. PowerShell Prompt is use like ls cd linux commad , and Prompt us "dir" "cd" windows cmd.

yoponchik commented 5 months ago

For anyone getting an error Cannot find corecrt.h after running the vcvars64 batch file, try

satoshiSchubert commented 3 months ago

if running vcvars64.bat don't work, you can try to run command directly in x64 Native Tools Command Prompt for VS 2019, it will automaticly setup corresponding envoronment :>