facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.81k stars 1.32k forks source link

Pytorch Installation Error Contradiction #1659

Closed raprakashvi closed 1 year ago

raprakashvi commented 1 year ago

🐛 Bugs / Unexpected behaviors

Hi, I am struggling to install pytorch3d on Windows 11 and have followed the issues for past few days. It's a windows 11 machine with 3070Ti card , Pytorch 2.0.1 , Visual studio 2019 with redistributable and build tools. x64 machine. Cuda 11.8 , Pytorch_Cuda Version = 11.8

Below is the error: ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\rp247\rp-repo\pytorch3d\pytorch3d\csrc -IC:\Users\rp247.conda\envs\pytorch3d\lib\site-packages\torch\include -IC:\Users\rp247.conda\envs\pytorch3d\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\rp247.conda\envs\pytorch3d\lib\site-packages\torch\include\TH -IC:\Users\rp247.conda\envs\pytorch3d\lib\site-packages\torch\include\THC -IC:\Users\rp247.conda\envs\pytorch3d\include -IC:\Users\rp247.conda\envs\pytorch3d\Include "-I\"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" -I\" "-I\"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" -I\" /EHsc /TpC:\Users\rp247\rp-repo\pytorch3d\pytorch3d\csrc\ball_query\ball_query_cpu.cpp /Fobuild\temp.win-amd64-cpython-39\Release\Users\rp247\rp-repo\pytorch3d\pytorch3d\csrc\ball_query\ball_query_cpu.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17 ball_query_cpu.cpp C:\Users\rp247.conda\envs\pytorch3d\lib\site-packages\torch\include\c10/core/DeviceType.h(10): fatal error C1083: Cannot open include file: 'functional': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe' failed with exit code 2"

I am installing the files in x64 Native Tools in admin mode and have followed the steps in #1227 to remove "c++14" with "[]" .

On entering "cl" in cmd: Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30152 for x64 Copyright (C) Microsoft Corporation. All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

"where cl " command gives "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe".

I am suspecting I need to edit the "ball_query"code somehow. Can you please recommend the solution? I have reinstalled and removed most of the softwares.

raprakashvi commented 1 year ago

@bottler tagging here.

bottler commented 1 year ago

This is something very basic going wrong with the compiler. It doesn't understand #include <functional>. It's always worth trying to add more visual studio components..

Maybe just maybe it thinks some file is C not C++, so maybe you could try adding /TP as a compiler option in setup.py in addition to the others.

2catycm commented 10 months ago

this issue is still occuring on my computer, it is right that it cannot find functional image

2catycm commented 10 months ago

but adding /TP does not work, I have added it here: image

2catycm commented 10 months ago

This is something very basic going wrong with the compiler. It doesn't understand #include <functional>. It's always worth trying to add more visual studio components..

Maybe just maybe it thinks some file is C not C++, so maybe you could try adding /TP as a compiler option in setup.py in addition to the others.

The guess that "cl.exe treats the .h as c" may not be correct, in the device.h file, I can see there are c++ libs in front of , but they can be included. image

2catycm commented 10 months ago

It is also not because of the version of C++17, I see that C++17 should have here: https://en.cppreference.com/w/cpp/header/functional

2catycm commented 10 months ago

found a relevant issue answered by VS https://developercommunity.visualstudio.com/t/Visual-Studio-2022-172-C-functional-h/10036384

2catycm commented 10 months ago

can you just build the binary for windows x64? It is so hard to build pytorch3d

2catycm commented 10 months ago

why not install the binary by pip

bottler commented 10 months ago

found a relevant issue answered by VS developercommunity.visualstudio.com/t/Visual-Studio-2022-172-C-functional-h/10036384

Are you using a release of Visual Studio newer than microsoft's comment there in Aug 2022? It should just work if you are, right?

2catycm commented 10 months ago

found a relevant issue answered by VS developercommunity.visualstudio.com/t/Visual-Studio-2022-172-C-functional-h/10036384

Are you using a release of Visual Studio newer than microsoft's comment there in Aug 2022? It should just work if you are, right?

Hi, I've just upgraded my VS2022, and it works!