cannot visualize inside Google Colab
monacv opened this issue · 5 comments
Hello,
Could you please guide me how to interactively or even statically visualize the obj file inside Google Colab?
import pywavefront
from pywavefront import visualization
obj = pywavefront.Wavefront('Data/examples/plane.obj')
visualization.draw(obj)
Error is:
---------------------------------------------------------------------------
NoSuchDisplayException Traceback (most recent call last)
<ipython-input-33-fcec2c1ce422> in <module>()
1 import pywavefront
----> 2 from pywavefront import visualization
3
4 obj = pywavefront.Wavefront('Data/examples/plane.obj')
5
7 frames
/usr/local/lib/python3.7/dist-packages/pyglet/canvas/xlib.py in __init__(self, name, x_screen)
121 self._display = xlib.XOpenDisplay(name)
122 if not self._display:
--> 123 raise NoSuchDisplayException('Cannot connect to "%s"' % name)
124
125 screen_count = xlib.XScreenCount(self._display)
NoSuchDisplayException: Cannot connect to "None"
I would interpret that to mean it is looking for an X11 server. Does Google Colab support that?
I did a quick search and turned up this Stackoverflow:
https://stackoverflow.com/questions/60886590/how-to-setup-pyglet-to-work-with-manim-in-colab
Seems Colab may support pyvirtualdisplay
. Can you give that a shot?
Looks like you need Xvfb (X virtual frame buffer). Is that something you have to manually add in Colab?
I did another search, and in this answer the person is first using apt
to install xvfb:
https://stackoverflow.com/questions/50107530/how-to-render-openai-gym-in-google-colab
Can you try that?
Could be easier to use trimesh for this : https://github.com/mikedh/trimesh
It does support inline visualization with tree.js. I have not used Google Colab much but I assume things working in notebook will also work there.