Location>code7788 >text

Compiling and Installing Specified Versions of PyTorch3D on Windows Platforms Using Source Code

Popularity:844 ℃/2024-10-05 17:17:24

Recently deployedSyncTalk There are many dependencies that need to be installed when the Virtual Digitizer project is executed into thepip install --no-index --no-cache-dir pytorch3d -f /pytorch3d/packaging/wheels/py38_cu113_pyt1121/With this command, the installation of PyTorch3D fails with the following message:

(synctalk) C:\SyncTalk>pip install --no-index --no-cache-dir pytorch3d -f /pytorch3d/packaging/wheels/py38_cu113_pyt1121/
Looking in indexes: /pypi/web/simple, /pypi/web/simple
ERROR: Could not find a version that satisfies the requirement pytorch3d (from versions: none)
ERROR: No matching distribution found for pytorch3d

So I thought about cloningfacebookresearch/pytorch3d The official repository source code is installed by itself via local compilation.

Understand that the SyncTalk Virtual Digital Man project relies on Pytorch version 1.12.1, CUDA version 11.3, and PyTorch3D version 0.7.2.

Compiling PyTorch3D requires an additional dependency on CUB and Visual Studio 2017 or Visual Studio 2019 in addition to CUDA.

According to the official recommendation of CUB, the corresponding CUB version for CUDA 11.3 is 1.11.0, and the cross-reference table is at the address:/NVIDIA/cub

So I downloaded it from the official CUB repository.Version 1.11.0 zip/NVIDIA/cub/archive/refs/tags/1.11.and unzip it to any path.

I was unzipping toC:\Program Files\cub-1.11.0and then configure theCUB_HOME The system environment variable, filled with this path, does not need to be added additionally to thePATH System environment variables.

In addition, it is also configuredCUDA_HOME This system environment variable, which points to theCUDA Toolkits 11.3 The installation path of theC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3

and to the system environment variablePATH I've added it.%CUDA_HOME%\bin;%CUDA_HOME%\libnvvp;

It should be re-emphasized that the pairing here issystem environment variableNo.user environment variable. The system global scope takes effect, not the current user.

As for Visual Studio 2017 or Visual Studio 2019, I only have Visual Studio 2022 installed on my computer.

The official VS download page is no longer open for downloads of VS2019 and earlier versions, and even if you log in to your Microsoft account to jump to the Subscription Services page, you can't get the available downloads with a regular subscription.

After some searching, I found that these permanent download links have not yet expired, so you can download the collection:

  • Latest version of Microsoft C++ generation tool - Visual Studio:/zh-hans/visual-cpp-build-tools/
  • Visual Studio 2022 Build Tools Download:/vs/17/release/vs_BuildTools.exe
  • Visual Studio 2019 Build Tools Download:/vs/16/release/vs_BuildTools.exe
  • Visual Studio 2017 Build Tools Download:/vs/15/release/vs_BuildTools.exe

Visual Studio Generation Tool After installation, you need to restart your computer.

After resolving the pre-existing dependencies and compilation environment, open thex64 Native Tools Command Prompt for VS 2017 maybex64 Native Tools Command Prompt for VS 2019, execute the following commands to start cloning PyTorch3D version 0.7.2 while compiling and installing it:

(synctalk) C:\SyncTalk>set DISTUTILS_USE_SDK=1
pip install "git+/facebookresearch/@v0.7.2"

After compiling and installing it successfully, we verify that it works:

(synctalk) C:\SyncTalk>python -c "import torch; import pytorch3d; print('PyTorch version:', torch.__version__); print('PyTorch3D version:', pytorch3d.__version__)"
PyTorch version: 1.12.1+cu113
PyTorch3D version: 0.7.2

PS:CUDA Toolkits 11.3 The download address is:/cuda-11.3.0-download-archive

To compile and install the latest stable version of PyTorch3D, you can put the@v0.7.2 change into@stable