Installing PyTorch3D fails with anaconda and pip on Windows 10
I saw that more people seem to have the same issue, but it was not resolved. I am trying to install Pytorch3D with Anaconda and got the following PackageNotFound error.
Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
  - pytorch3d
Current channels:
  - https://conda.anaconda.org/pytorch3d/win-64
  - https://conda.anaconda.org/pytorch3d/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're looking for, navigate to
    https://anaconda.org
and use the search bar at the top of the page.



I have also tried using pip install 'git+https://github.com/facebookresearch/pytorch3d.git'
and get the following:
C:\Users\Alexandra&gt;pip install 'git+https://github.com/facebookresearch/pytorch3d.git'
ERROR: Invalid requirement: &quot;'git+https://github.com/facebookresearch/pytorch3d.git'&quot;

C:\Users\Alexandra&gt;pip install git+https://github.com/facebookresearch/pytorch3d.git
Collecting git+https://github.com/facebookresearch/pytorch3d.git
  Cloning https://github.com/facebookresearch/pytorch3d.git to c:\users\alexan~1\appdata\local\temp\pip-req-build-uspo7an4
  Running command git clone -q https://github.com/facebookresearch/pytorch3d.git 'C:\Users\ALEXAN~1\AppData\Local\Temp\pip-req-build-uspo7an4'
  ERROR: Error [WinError 2] The system cannot find the file specified while executing command git clone -q https://github.com/facebookresearch/pytorch3d.git 'C:\Users\ALEXAN~1\AppData\Local\Temp\pip-req-build-uspo7an4'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

I am on Windows 10, using python 3.8, PyTorch 1.5 and CUDA 10.2.
I am very new to python, so I have no idea how to fix this (you can tell, that I've never installed from git before..) (please be lenient!)
Thank you!
EDIT: Thank you for your answers. I did install Git and it got me a bit further, but still not completeing the build..

Also, interesting enough, when I run the commands
!pip install torch torchvision
!pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'

in Google Collab it seems to work, but I cannot run it , let's say, in jupyter.
Any more ideas?

Edit 10-17-2022
With CUDA 11.6 downloading CUB and setting CUB_HOME is no longer necessary. Trying to use CUB_HOME will give nvcc.exe compile error. Any previous CUB_HOME environment variable should be deleted and command line restarted before running setup.

Original Answer
I have also tried to install pytorch3d on windows 10. As of writing this there is no windows package in, https://anaconda.org/pytorch3d/pytorch3d.
Pytorch3d install doc has detailed instructions but some information is missing and only found inside various issues. Following various issues I was able get pytorch3d installed by compiling from source on pytorch 1.8.1 and 1.10.0(This version is not supported yet in official docs for pytorch3d 0.6.0).
I have tested on pytorch 1.8.1 with CUDA 10.2 and pytorch 1.10.0 with CUDA 11.3. I had CUDA Toolkit 11.0, CuDNN installed separately with environment variables set to be used by tensorflow gpu. For both environment a new python 3.9 was used. Visual studio 16.11.5 was used with Desktop Development with C++ enabled, CMake 3.21.3.
It is probably better to have same CUDA Toolkit version as the Pytorch GPU version. There was warning regarding version but in my case it was installed successfully.
The pytorch3d source code must be downloaded and extracted in order to compile. When running python setup.py install from pytorch3d folder it looked for CUDA_HOME. It was able to find correct CUDA path probably based on other flags.
I initially faced these errors,

RuntimeError: Error compiling objects for extension.
xutility(...): error: expected a &quot;(&quot;

Install on windows

Create conda enviroment, install torch and dependencies.

conda create -n pytorch3d python=3.9
conda activate pytorch3d
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
conda install -c fvcore -c iopath -c conda-forge fvcore iopath


Install appropriate CUDA Toolkit, CuDNN and set enviroment variables.

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\libnvvp
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\extras\CUPTI\lib64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include


Set correct path to cl.exe Visual C++ compiler. This will allow to run compilation from conda prompt with correct environment selected. Host x64 was used and x86 for the folder inside as x64 one gave error for me. In my case it was,

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x86


Following this issue, PYTORCH3D_NO_NINJA system environment variable was set with value of 1.

FORCE_CUDA with value of 1 (though not required if CUDA is available in pytorch) and CUB_HOME system environment variable was set by downloading it from, https://github.com/NVIDIA/cub/releases.


PYTORCH3D_NO_NINJA 1
CUB_HOME C:\portable\cub-1.9.9


The following env variable were probably set by CUDA Toolkit install.

CUDA_PATH_V11_0 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0
CUDA_PATH C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0


Following this issue instead of removing -std=c++14 from extra_compile_args in setup.py, commenting out &quot;-std=c++14&quot; in nvcc_args worked for me. I did check if the suggested method in the issue works.

Now running python setup.py install from pytorch3d source folder should start compile and install it.

Install following requirements in conda env to run demos and examples.


conda install jupyter
pip install scikit-image matplotlib imageio plotly opencv-python

Some of the steps mentioned above is probably not needed. There is no need to modify any header files. This is the source that worked for me, https://github.com/facebookresearch/pytorch3d/tree/bfeb82efa38f29ed5b9cf8d8986fab744fe559ea.
