umyelab / LabGym

Quantify user-defined behaviors.
GNU General Public License v3.0
64 stars 5 forks source link

Issue building wheel for detectron2 #207

Open nepm15 opened 3 weeks ago

nepm15 commented 3 weeks ago

I have followed the installation instructions using a Windows 10 computer with NVIDIA GPU onboard using python version 3.9. I went through previous detectron2 issues in the Issues tab.

When attempting to install detectron2 - I get the following error which points to an error in assert.h file

Any suggestions on how to remedy this failure?

> "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\milman\AppData\Local\Temp\1\pip-req-build-k2c6yk3o\detectron2\layers\csrc -IC:\Users\milman\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\include -IC:\Users\milman\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\milman\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\include\TH -IC:\Users\milman\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\include\THC -IC:\Users\milman\AppData\Local\Programs\Python\Python39\include -IC:\Users\milman\AppData\Local\Programs\Python\Python39\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /EHsc /TpC:\Users\milman\AppData\Local\Temp\1\pip-req-build-k2c6yk3o\detectron2\layers\csrc\ROIAlignRotated\ROIAlignRotated_cpu.cpp /Fobuild\temp.win-amd64-cpython-39\Release\Users\milman\AppData\Local\Temp\1\pip-req-build-k2c6yk3o\detectron2\layers\csrc\ROIAlignRotated\ROIAlignRotated_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
>       ROIAlignRotated_cpu.cpp
>       C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\include\cassert(9): fatal error C1083: Cannot open include file: 'assert.h': No such file or directory
>       error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX86\\x64\\cl.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 detectron2
>   Running setup.py clean for detectron2
> Failed to build detectron2
> ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (detectron2)

Thank you!

yujiahu415 commented 3 weeks ago

Hi,

Have you installed the Microsoft c++ build tools? And also, can you let me know the version of your current PyTorch? Thanks!

nepm15 commented 2 weeks ago

Hi !

I have installed Microsoft c++ build tools, and uninstalled and reinstalled to double check. i was previously using pytorch 3.2.1 but following the updated instructions, I tried with 2.0.1

I still receive the assert.h error when trying to install detectron. I wonder if there are any unique instructions for the Visual Studio C++ install that I am missing. Does it require a different SDK for Windows 10 compared to the screen shot where you have Windows 11 SDK checked off? I tried both installs.

Thanks for your help.

yujiahu415 commented 2 weeks ago

Hi, You may try adding the Individual components of Windows 10 SDK, C++ CMake tools for Windows, and MSVC v142 - VS 2019 C++ build tools when installing the c++ build tools. See this thread: https://www.reddit.com/r/Oobabooga/comments/13iv9wu/visual_studio_compile_errors/?rdt=57195. You can also take a look at this: https://stackoverflow.com/questions/52325237/visual-studio-unable-to-find-assert-h. You may also try different versions of torch, like the newest, 2.4.0 or a previous 2.2.2 to see if they can help. This error seems to be originated from torch or c++ tools. Let me know whether this works or not. Thanks!