NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.35k stars 144 forks source link

nvdiffrast's custom torch extension build fails on Google Colab #6

Closed nurpax closed 3 years ago

nurpax commented 3 years ago

Running nvdiffrast on Colab is probably possible but it doesn't currently work.

Something like this should work (this uses Google Drive mounts to make the nvdiffrast checkout editable -- if there's a better method for updating code on Colab, please leave a comment!):

!pip install ninja
from google.colab import drive
drive.mount('/content/drive')
%cd "/content/drive/My Drive/colab"
!git clone https://github.com/NVlabs/nvdiffrast.git
%cd "nvdiffrast"
!pip install .

%cd ".."
import nvdiffrast
import nvdiffrast.torch as dr
gl = dr.RasterizeGLContext()

The above fails with the following exception:

RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/torch/utils/cpp_extension.py in _run_ninja_build(build_directory, verbose, error_prefix)
   1536         if hasattr(error, 'output') and error.output:  # type: ignore
   1537             message += ": {}".format(error.output.decode())  # type: ignore
-> 1538         raise RuntimeError(message) from e
   1539 
   1540 
RuntimeError: Error building extension 'nvdiffrast_plugin'

The most likely reason is that the Torch extension build fails on some compiler or linker error. Unfortunately, the ninja build output logs get somehow eaten by Colab or our code, and it's hard to figure out what's wrong.

msqrt commented 3 years ago

This issue doesn't stand as of version 0.2.5, right?

s-laine commented 3 years ago

Correct — the only blocker with Colab was the glew requirement that was removed in 0.2.5. Closing the issue for the time being, but let's reopen if the problem appears again due to changes in Colab environment.