How to install Pytorch3d under Windows GPU

How to install Pytorch3d under Windows

My laptop has a Windows GPU and failed to install Pytorch3d. It took a lot of effort to install it. To commemorate my persistence, I share it with everyone.

Installation of Pytorch3d under WIN

1. Question:

Recently, when I started 3D reconstruction, I found that many project programs require the Pytorch3d library. Its official website defines it as:

PyTorch3D provides efficient, reusable components for 3D Computer Vision research with PyTorch.

It can be seen that the Pytorch3d library can provide a variety of components for 3D visual processing. Its installation under Ubuntu is relatively simple, but it is a bit cumbersome under Win. This post is a record of personal installation methods.

Recommended content

Edit Edit Edit

2. Installation method

Installation points: Strict correspondence between cuda, pytorch, and NVIDIA CUB versions

Links required for installation:

Before installation, you must first determine the version correspondence. My installed version is:

CUDA Toolkit 11.3 + pytorch 1.11.0 + Visual Studio 2019 + Pytorch3d 0.6.2 + Python 3.10

1. For NVIDIA CUB, the version relationship between it and CUDA Toolkit is as follows:

 

The cuda version I installed is 11.3, so CUB selected the corresponding 1.11.0 version. After downloading and decompressing, add its path to the environment variable:

 

2. Install dependencies:

conda install -c fvcore -c iopath -c conda-forge fvcore iopath

3. Select the Pytorch3d version. Each version of Pytorch3d has its applicable pytorch version indicated, as shown below:

 

The above picture shows that the applicable Pytorch versions of pytorch3d 0.6.2 are 1.10.1, 1.10.2, 1.11.0, and the applicable Python is 3.10, but Pytorch1.6.0 and Python3.6 are no longer supported. Other versions of torch still follow this Download the corresponding pytorch3d version

4. After installing VS 2019, open the "x64 Native Tools Command Prompt for VS 2019" terminal as shown below, and then cd to the directory path where pytorch3d is decompressed:


Enter in order:

 Set environment variables in Command Prompt on Windows:

set DISTUTILS_USE_SDK=1
set PYTORCH3D_NO_NINJA=1

Set environment variables in PowerShell on Windows:

$env:DISTUTILS_USE_SDK = 1

Set environment variables on Linux and macOS:

export DISTUTILS_USE_SDK=1

Then, modify the source code of the setup.py file in pytorch3d: change extra_compile_args = {“cxx”: [“-std=c++14”]} to: extra_compile_args = {“cxx”: []};

 

5. Finally enter in the "x64 Native Tools Command Prompt for VS 2019" terminal:

python setup.py install --user

The installation process took about 5 minutes on my computer, and the page kept jumping around. Finally, it finally showed success:

If your installation still fails, please contact me

Guess you like

Origin blog.csdn.net/weixin_46587777/article/details/131016797