Error building extension `nvdiffrast_plugin_gl`
hayoung-jeremy opened this issue · 2 comments
hayoung-jeremy commented
Device info
- RTX 3060 ti, 8GB vram
- CUDA 12.1
- tested on WSL2 with
conda
environment
Installation process
conda create -n LGM python=3.10
conda activate LGM
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia # from pytorch.org
conda install xformers -c xformers
git clone --recursive https://github.com/ashawkey/diff-gaussian-rasterization
pip install ./diff-gaussian-rasterization
# for mesh extraction
pip install git+https://github.com/NVlabs/nvdiffrast
# other dependencies
pip install -r requirements.txt
Reproduction of the error
Installation was successful, and so was the Inference
stage.
The error happens when it comes to testing the mesh conversion
stage.
As you can see in the title of this issue, nvidiffrast
building failed, and it complained about not finding EGL
stuffs.
(LGM) hayoung@altava:~/projects/LGM$ python convert.py big --test_path /mnt/c/hayoung/LGM/result/case2-1-01.ply
Number of points at loading : 36185
Traceback (most recent call last):
File "/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2096, in _run_ninja_build
subprocess.run(
File "/home/hayoung/anaconda3/envs/LGM/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/hayoung/projects/LGM/convert.py", line 458, in <module>
converter = Converter(opt).cuda()
File "/home/hayoung/projects/LGM/convert.py", line 83, in __init__
self.glctx = dr.RasterizeGLContext()
File "/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/torch/ops.py", line 221, in __init__
self.cpp_wrapper = _get_plugin(gl=True).RasterizeGLStateWrapper(output_db, mode == 'automatic', cuda_device_idx)
File "/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/torch/ops.py", line 118, in _get_plugin
torch.utils.cpp_extension.load(name=plugin_name, sources=source_paths, extra_cflags=opts, extra_cuda_cflags=opts+['-lineinfo'], extra_ldflags=ldflags, with_cuda=True, verbose=False)
File "/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1306, in load
return _jit_compile(
File "/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1710, in _jit_compile
_write_ninja_file_and_build_library(
File "/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1823, in _write_ninja_file_and_build_library
_run_ninja_build(
File "/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2112, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'nvdiffrast_plugin_gl': [1/4] c++ -MMD -MF rasterize_gl.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin_gl -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/TH -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/hayoung/anaconda3/envs/LGM/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -DNVDR_TORCH -c /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/rasterize_gl.cpp -o rasterize_gl.o
FAILED: rasterize_gl.o
c++ -MMD -MF rasterize_gl.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin_gl -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/TH -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/hayoung/anaconda3/envs/LGM/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -DNVDR_TORCH -c /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/rasterize_gl.cpp -o rasterize_gl.o
In file included from /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/rasterize_gl.h:16,
from /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/rasterize_gl.cpp:9:
/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/glutil.h:36:10: fatal error: EGL/egl.h: No such file or directory
36 | #include <EGL/egl.h>
| ^~~~~~~~~~~
compilation terminated.
[2/4] c++ -MMD -MF torch_rasterize_gl.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin_gl -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/TH -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/hayoung/anaconda3/envs/LGM/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -DNVDR_TORCH -c /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/torch/torch_rasterize_gl.cpp -o torch_rasterize_gl.o
FAILED: torch_rasterize_gl.o
c++ -MMD -MF torch_rasterize_gl.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin_gl -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/TH -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/hayoung/anaconda3/envs/LGM/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -DNVDR_TORCH -c /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/torch/torch_rasterize_gl.cpp -o torch_rasterize_gl.o
In file included from /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/torch/../common/rasterize_gl.h:16,
from /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/torch/torch_rasterize_gl.cpp:12:
/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/torch/../common/glutil.h:36:10: fatal error: EGL/egl.h: No such file or directory
36 | #include <EGL/egl.h>
| ^~~~~~~~~~~
compilation terminated.
[3/4] c++ -MMD -MF glutil.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin_gl -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/TH -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/hayoung/anaconda3/envs/LGM/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -DNVDR_TORCH -c /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/glutil.cpp -o glutil.o
FAILED: glutil.o
c++ -MMD -MF glutil.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin_gl -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/TH -isystem /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /home/hayoung/anaconda3/envs/LGM/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -DNVDR_TORCH -c /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/glutil.cpp -o glutil.o
In file included from /home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/glutil.cpp:14:
/home/hayoung/anaconda3/envs/LGM/lib/python3.10/site-packages/nvdiffrast/common/glutil.h:36:10: fatal error: EGL/egl.h: No such file or directory
36 | #include <EGL/egl.h>
| ^~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
ashawkey commented
@hayoung-jeremy Hi, this indicates a missing of OpenGL (which is usually installed with the nvidia driver). Please try appending --force_cuda_rast
.
hayoung-jeremy commented
@hayoung-jeremy Hi, this indicates a missing of OpenGL (which is usually installed with the nvidia driver). Please try appending
--force_cuda_rast
.
It really does resolve my error, thank you so much!