facebookresearch / pytorch3d

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

Get error from ninja. #1827

Open ultimatech-cn opened 3 months ago

ultimatech-cn commented 3 months ago

If you do not know the root cause of the problem / bug, and wish someone to help you, please post according to this template:

🐛 Bugs / Unexpected behaviors

After git clone, get error when executing pip install .


 cl /showIncludes /nologo /O2 /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -DWITH_CUDA -DTHRUST_IGNORE_CUB_VERSION_CHECK -IE:\MOFA-Video\MOFA-Video-Hybrid\pytorch3d\pytorch3d\csrc -ID:\ProgramData\anaconda3\envs\mofa\lib\site-packages\torch\include -ID:\ProgramData\anaconda3\envs\mofa\lib\site-packages\torch\include\torch\csrc\api\include -ID:\ProgramData\anaconda3\envs\mofa\lib\site-packages\torch\include\TH -ID:\ProgramData\anaconda3\envs\mofa\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" -ID:\ProgramData\anaconda3\envs\mofa\include -ID:\ProgramData\anaconda3\envs\mofa\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -c E:\MOFA-Video\MOFA-Video-Hybrid\pytorch3d\pytorch3d\csrc\sample_pninja: fatal: ReadFile: 鍙ユ焺鏃犳晥銆\x82

    df\sample_pdf_cpu.cpp /FoE:\MOFA-Video\MOFA-Video-Hybrid\pytorch3d\build\temp.win-amd64-cpython-310\Release\MOFA-Video\MOFA-Video-Hybrid\pytorch3d\pytorch3d\csrc\sample_pdf\sample_pdf_cpu.obj -std=c++17 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17
    CreateProcess failed: The system cannot find the file specified.
    Traceback (most recent call last):
      File "D:\ProgramData\anaconda3\envs\mofa\lib\site-packages\torch\utils\cpp_extension.py", line 1893, in _run_ninja_build
        subprocess.run(
      File "D:\ProgramData\anaconda3\envs\mofa\lib\subprocess.py", line 524, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

Instructions To Reproduce the Issue:

Please include the following (depending on what the issue is):

  1. Any changes you made (git diff) or code you wrote
    
    conda create -n mofa python==3.10

2. The exact command(s) you ran:
pip install .
bottler commented 3 months ago

I suspect you don't have enough visual studio components installed to build C++ python extensions. Also it's worth checking through the other issues which include "The system cannot find the file specified" like yours. We've had a few.

ultimatech-cn commented 2 months ago

Thanks for the reply. What I am installing is community version of VS2022

image
bottler commented 2 months ago

I think you need to be running in that "x64 Native Tools Command Prompt..." not in a normal command prompt.

What happens when you type "nvcc" at the prompt?

And can you go back to the VS installer and install lots of components? I can't remember exactly which ones you need, but this error can be a symptom of not having enough. Maybe look at other issues...

ultimatech-cn commented 2 months ago

Thanks for your reply, What I am choosing is "x64 Native Tools Command Prompt..." , becasue it run [vcvarsall.bat] to setup env. I run this [vcvarsall.bat] in my conda env to simulate that.

C:\Windows\System32>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Mon_Apr__3_17:36:15_Pacific_Daylight_Time_2023
Cuda compilation tools, release 12.1, V12.1.105
Build cuda_12.1.r12.1/compiler.32688072_0

I will check the VS installation later. Is there any other workround for that, like wheels file?

bottler commented 2 months ago

No - on Windows you need to build from source with Visual Studio.