NVlabs / nvdiffrec

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

Error when doing first time setup on Windows #38

Closed graham-eisele closed 2 years ago

graham-eisele commented 2 years ago

I get the following error when running the command pip install --global-option="--no-networks" git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch imageio_download_bin freeimage on Windows 10:


    100 errors detected in the compilation of "C:/Users/Graham/AppData/Local/Temp/pip-req-build-od5yzghh/src/encoding.cu".
    Compilation terminated.
    encoding.cu
    [5/5] cl /showIncludes /nologo /O2 /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -IC:\Users\Graham\AppData\Local\Temp\pip-req-build-od5yzghh/include -IC:\Users\Graham\AppData\Local\Temp\pip-req-build-od5yzghh/dependencies -IC:\Users\Graham\AppData\Local\Temp\pip-req-build-od5yzghh/dependencies/cutlass/include -IC:\Users\Graham\AppData\Local\Temp\pip-req-build-od5yzghh/dependencies/cutlass/tools/util/include -IC:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\include -IC:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\include\TH -IC:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" -IC:\Users\Graham\.conda\envs\dmodel\include -IC:\Users\Graham\.conda\envs\dmodel\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\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" -c C:\Users\Graham\AppData\Local\Temp\pip-req-build-od5yzghh\bindings\torch\tinycudann\bindings.cpp /FoC:\Users\Graham\AppData\Local\Temp\pip-req-build-od5yzghh\bindings\torch\build\temp.win-amd64-3.9\Release\tinycudann/bindings.obj /std:c++14 -DTCNN_MIN_GPU_ARCH=75 -DTCNN_NO_NETWORKS -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0
    ninja: build stopped: subcommand failed.
    Traceback (most recent call last):
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\utils\cpp_extension.py", line 1717, in _run_ninja_build
        subprocess.run(
      File "C:\Users\Graham\.conda\envs\dmodel\lib\subprocess.py", line 528, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Graham\AppData\Local\Temp\pip-req-build-od5yzghh\bindings/torch\setup.py", line 117, in <module>
        setup(
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\__init__.py", line 87, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
        return run_commands(dist)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
        dist.run_commands()
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
        self.run_command(cmd)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\dist.py", line 1214, in run_command
        super().run_command(command)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
        cmd_obj.run()
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\command\install.py", line 68, in run
        return orig.install.run(self)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\command\install.py", line 664, in run
        self.run_command('build')
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\dist.py", line 1214, in run_command
        super().run_command(command)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
        cmd_obj.run()
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\dist.py", line 1214, in run_command
        super().run_command(command)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
        cmd_obj.run()
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
        _build_ext.run(self)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 339, in run
        self.build_extensions()
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\utils\cpp_extension.py", line 735, in build_extensions
        build_ext.build_extensions(self)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\command\build_ext.py", line 202, in build_extension
        _build_ext.build_extension(self, ext)
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 528, in build_extension
        objects = self.compiler.compile(sources,
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\utils\cpp_extension.py", line 708, in win_wrap_ninja_compile
        _write_ninja_file_and_compile_objects(
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\utils\cpp_extension.py", line 1399, in _write_ninja_file_and_compile_objects
        _run_ninja_build(
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\torch\utils\cpp_extension.py", line 1733, in _run_ninja_build
        raise RuntimeError(message) from e
    RuntimeError: Error compiling objects for extension
    Error in atexit._run_exitfuncs:
    Traceback (most recent call last):
      File "C:\Users\Graham\.conda\envs\dmodel\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
        return stream.closed
    ValueError: underlying buffer has been detached
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Graham\.conda\envs\dmodel\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Graham\\AppData\\Local\\Temp\\pip-req-build-od5yzghh\\bindings/torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Graham\\AppData\\Local\\Temp\\pip-req-build-od5yzghh\\bindings/torch\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-networks install --record 'C:\Users\Graham\AppData\Local\Temp\pip-record-2fzq7zhs\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Graham\.conda\envs\dmodel\Include\tinycudann' Check the logs for full command output.```

Windows: Windows 10
Cuda: 11.3
PyTorch: 1.10
Visual Studio: Visual Studio 2019 with build tools installed
JHnvidia commented 2 years ago

Hi @Graham956,

It's pretty hard to say, but a common error is that CUDA 11.3 (toolkit) doesn't work on the most recent versions of visual studio. You'll notice it on the C++ compilation reporting lots of errors in the stdlib headers. I'm using the more recent 11.6 version of the toolkit, but still have the 11.3 version of Pytorch, so I would suggest upgrading to the latest version and trying again. If it still doesn't work, please inquire at the tiny-cuda-nn github page as the compilation error is in that package.

cx-zzz commented 2 years ago

i have the same mistake and it worked when i uninstall my VS2019 16.11 and reinstall VS2019 16.9.4, maybe it can help you.

RobTranquillo commented 2 years ago

i have the same mistake and it worked when i uninstall my VS2019 16.11 and reinstall VS2019 16.9.4, maybe it can help you.

Great! I'am de-/installing here for hours, with no success. So that trick worked. Thank you!

PS: Only the build tools are needed from that Version of Visual Studio. For persons like me, without a professional subscription, is no download of the full version of VS2019 Community available. So here is the direkt link to the exact build tools version: https://download.visualstudio.microsoft.com/download/pr/3105fcfe-e771-41d6-9a1c-fc971e7d03a7/e0c2f5b63918562fd959049e12dffe64bf46ec2e89f7cadde3214921777ce5c2/vs_BuildTools.exe

Here is the download page if you scared to click on direkt links: https://docs.microsoft.com/en-us/visualstudio/releases/2019/history

graham-eisele commented 2 years ago

i have the same mistake and it worked when i uninstall my VS2019 16.11 and reinstall VS2019 16.9.4, maybe it can help you.

Yes that worked! Thank you @cx-zzz. Also I had cuda 11.1 installed and installing 11.3 instead.