Pytorch3d doesnt install despite all the requirements achieved

ShayanSep: <p>python 3.10.10, CUDA=12.1<br>
i want to install pytorch3d and i tried all the versions but i cant install it<br>
i first try to install the requirements like this :</p>
<p>conda install pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=12.1 -c pytorch -c nvidia<br>
conda install -c fvcore -c iopath -c conda-forge fvcore iopath<br>
conda install -c conda-forge scikit-image matplotlib imageio plotly opencv ninja</p>
<p>and then try to clone and install it like this:<br>
git clone <a href="https://github.com/facebookresearch/pytorch3d.git" class="inline-onebox" rel="noopener nofollow ugc">GitHub - facebookresearch/pytorch3d: PyTorch3D is FAIR's library of reusable components for deep learning with 3D data</a> ( the address changes when i type it here but the address is the github to pytorch3d code)<br>
cd pytorch3d<br>
python setup.py clean<br>
python setup.py install</p>
<p>but i keep getting RuntimeError: Error compiling objects for extension</p>
<p>i cant install it no matter what versions i use<br>
i used a combination of python 3.12, 3.11, 3.10, 3.9 with CUDA 12.5, 12.1, 11.8<br>
i installed the right Microsoft visual studio with C++ package<br>
and my CUDA is “True”</p>
<p>please help me <img src="https://discuss.pytorch.org/images/emoji/apple/sob.png?v=12" title=":sob:" class="emoji" alt=":sob:" loading="lazy" width="20" height="20">,<br>
thank you for your attention,<br>
best regards.</p>

AlphaBetaGamma96: <p>Hi <a class="mention" href="/u/shayansep">@ShayanSep</a>,</p>
<p>Can you post the full stacktrace of the error?</p>
<p>Also, have you created a new <code>conda</code> environment for your install as per the instructions of Pytorch3D? <a href="https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md" class="inline-onebox" rel="noopener nofollow ugc">pytorch3d/INSTALL.md at main · facebookresearch/pytorch3d · GitHub</a></p>

ShayanSep: <p>conda create -n pytorch3d_env python=3.10<br>
conda activate pytorch3d_env</p>
<p>conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia<br>
conda install -c fvcore -c iopath -c conda-forge fvcore iopath<br>
conda install -c conda-forge scikit-image matplotlib imageio plotly opencv ninja</p>
<p>git clone <a href="https://github.com/facebookresearch/pytorch3d.git" class="inline-onebox" rel="noopener nofollow ugc">GitHub - facebookresearch/pytorch3d: PyTorch3D is FAIR's library of reusable components for deep learning with 3D data</a><br>
cd pytorch3d<br>
python setup.py clean<br>
python setup.py install</p>
<p>these are all the codes i used to install it<br>
and this is the error ( the original error was much longer i just copied the last part ):</p>
<p>cl : Command line warning D9002 : ignoring unknown option ‘-std=c++17’<br>
ninja: build stopped: subcommand failed.<br>
Traceback (most recent call last):<br>
File “C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\torch\utils\cpp_extension.py”, line 2107, in _run_ninja_build<br>
subprocess.run(<br>
File “C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\subprocess.py”, line 526, in run<br>
raise CalledProcessError(retcode, process.args,<br>
subprocess.CalledProcessError: Command ‘[‘ninja’, ‘-v’]’ returned non-zero exit status 1.</p>
<pre><code>The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "&lt;string&gt;", line 2, in &lt;module&gt;
  File "&lt;pip-setuptools-caller&gt;", line 34, in &lt;module&gt;
  File "C:\Users\Administrator\pytorch3d\setup.py", line 144, in &lt;module&gt;
    setup(
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\__init__.py", line 104, in setup
    return distutils.core.setup(**attrs)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\core.py", line 184, in setup
    return run_commands(dist)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\core.py", line 200, in run_commands
    dist.run_commands()
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\dist.py", line 967, in run_command
    super().run_command(command)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\command\develop.py", line 34, in run
    self.install_for_development()
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\command\develop.py", line 111, in install_for_development
    self.run_command('build_ext')
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command
    self.distribution.run_command(command)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\dist.py", line 967, in run_command
    super().run_command(command)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\command\build_ext.py", line 91, in run
    _build_ext.run(self)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 359, in run
    self.build_extensions()
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\torch\utils\cpp_extension.py", line 870, in build_extensions
    build_ext.build_extensions(self)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 479, in build_extensions
    self._build_extensions_serial()
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 505, in _build_extensions_serial
    self.build_extension(ext)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\command\build_ext.py", line 252, in build_extension
    _build_ext.build_extension(self, ext)
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 560, in build_extension
    objects = self.compiler.compile(
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\torch\utils\cpp_extension.py", line 842, in win_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\torch\utils\cpp_extension.py", line 1783, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "C:\ProgramData\miniconda3\envs\pytorch3d_env\lib\site-packages\torch\utils\cpp_extension.py", line 2123, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]
</code></pre>
<p>note: This error originates from a subprocess, and is likely not a problem with pip.</p>

AlphaBetaGamma96: <aside class="quote no-group" data-username="ShayanSep" data-post="3" data-topic="205087">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/shayansep/48/70914_2.png" class="avatar"> ShayanSep:</div>
<blockquote>
<p>subprocess.CalledProcessError: Command ‘[‘ninja’, ‘-v’]’ returned non-zero exit status 1.</p>
<pre><code class="lang-auto">
</code></pre>
</blockquote>
</aside>
<p>Do you have <code>ninja</code> installed?</p>