ShenhanQian / GaussianAvatars

[CVPR 2024 Highlight] The official repo for "GaussianAvatars: Photorealistic Head Avatars with Rigged 3D Gaussians"
https://shenhanqian.github.io/gaussian-avatars
Other
619 stars 93 forks source link

Build error for diff-gaussian-rasterization submodule #12

Closed psiQAQ closed 9 months ago

psiQAQ commented 9 months ago

Problem Description:

When attempting to install the diff-gaussian-rasterization submodule as part of the GaussianAvatars project on Windows, I encounter a build error with the following message when using pip install -r requirements.txt:

Building wheel for diff-gaussian-rasterization (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [55 lines of output]
No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7'
running bdist_wheel
running build
running build_py
...
Failed to build diff-gaussian-rasterization simple-knn

and at the same time torch.cuda.is_available() return false

However, the build and installation process succeeds without any issues when using conda with the following command:

conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia

System Environment:

OS: Windows 11 Python Version: 3.10 CUDA Version: 11.7

Steps to Reproduce: Install PyTorch 2.0.1, torchvision 0.15.2 using pip. Attempt to build and install the diff-gaussian-rasterization submodule.

Potential Reason: It seems like the pip installation does not properly handle or recognize the CUDA environment, leading to the build process not finding the CUDA runtime. This issue might be related to the way pip installs PyTorch and its interaction with CUDA, differing from how conda manages package installations and environment configurations.

Suggested Improvement:

Could the installation documentation or setup scripts be updated to address or provide guidance for this issue? It would be helpful to have a note or workaround for users facing similar issues when using pip to install PyTorch and compile CUDA-dependent submodules.

ShenhanQian commented 9 months ago

Thanks for reporting this issue.

The command pip install torch==2.0.1 torchvision installs PyTorch with CUDA on Linux while with CPU backend on Windows. Therefore, we explicitly spot the CUDA version to avoid confusion:

pip install torch==2.0.1 torchvision --index-url https://download.pytorch.org/whl/cu117

Meanwhile, we found that PyTorch3D failed to compile on Windows with CUDA 11.7. In the end, PyTorch 2.2.0 with CUDA 12.1 worked on our side. Please refer to README.md for updated installation instructions.