DESI-UR / VAST

Void Analysis Software Toolkit
https://vast.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
9 stars 8 forks source link

Visualization not working on Linux/Wayland #72

Closed lavaux closed 2 years ago

lavaux commented 2 years ago

Running example_scripts/visualize_voids_VoidFinder.py on linux/wayland triggers an error in PyOpenGL and PyOpenGLTK.

I have not reported that issue to PyOpenGLTK yet. However I would suggest to include a word of warning in the documentation/readme about compatibility issues.

Here is the stacktrace:

Traceback (most recent call last):
  File "/home/guilhem/Software/VAST/example_scripts/visualize_voids_VoidFinder.py", line 76, in <module>
    viz = VoidRender(holes_xyz=holes_xyz, 
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/vast-1.1.1-py3.9-linux-x86_64.egg/vast/voidfinder/viz/void_render.py", line 551, in __init__
    app.Canvas.__init__(self, 
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/vispy/app/canvas.py", line 173, in __init__
    self._app = use_app(call_reuse=False)
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/vispy/app/_default_app.py", line 47, in use_app
    default_app = Application(backend_name)
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/vispy/app/application.py", line 47, in __init__
    self._use(backend_name)
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/vispy/app/application.py", line 233, in _use
    __import__(mod_name, globals(), level=1)
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/vispy/app/backends/_tk.py", line 29, in <module>
    import pyopengltk
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/pyopengltk/__init__.py", line 28, in <module>
    from pyopengltk.linux import OpenGLFrame
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/pyopengltk/linux.py", line 8, in <module>
    from OpenGL import GL, GLX
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/OpenGL/GLX/__init__.py", line 3, in <module>
    from OpenGL.GLX.VERSION.GLX_1_0 import *
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/OpenGL/GLX/VERSION/GLX_1_0.py", line 14, in <module>
    from OpenGL.raw.GLX.VERSION.GLX_1_0 import *
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/OpenGL/raw/GLX/VERSION/GLX_1_0.py", line 44, in <module>
    def glXChooseVisual(dpy,screen,attribList):pass
  File "/home/guilhem/venv/vast/lib64/python3.9/site-packages/OpenGL/raw/GLX/VERSION/GLX_1_0.py", line 13, in _f
    return _p.createFunction( function,_p.PLATFORM.GLX,'GLX_VERSION_GLX_1_0',error_checker=_errors._error_checker)
AttributeError: 'EGLPlatform' object has no attribute 'GLX'
QuiteAFoxtrot commented 2 years ago

Have you encountered this issue when not using the Wayland backend? I could be a bit out of date but isn't Wayland still considered a somewhat experimental choice of graphical server? I don't see any harm in pointing this out in the docs though.

lavaux commented 2 years ago

Sorry I did not reply to this. But indeed no, this problem does not occur on X backend and I did not try on Windows or OSX. Wayland is not experimental anymore for ~2 years minimum. Actually this is the recommended backend for past version of Ubuntu and it will be the default for Ubuntu 22.04 including for NVIDIA.

Some references:

QuiteAFoxtrot commented 2 years ago

Ok thanks @lavaux I think we'll need to take a bit of a deeper look at this

QuiteAFoxtrot commented 2 years ago

Had a chance to do some testing - indeed this visualization does not work on Wayland, but I am marking this issue Closed because I cannot get anything else to work on Wayland either, even a simple script like:

import matplotlib.pyplot as plt
data = numpy.arange(10)
plt.plot(data, data)
plt.show()

fails with libGL errors. I believe this is a Wayland problem, not a VAST issue (at least well outside the scope of what VAST is intended to support), but we will update our docs to reflect this known issue.

If its worth mentioning, it seems that even in the new Ubuntu 22.04 LTS release Nvidia asked to switch back to Xorg at the last second (on launch day) so I think its quite reasonable to wait for the Wayland devs to keep doing their thing before we can make a good attempt to support it, perhaps in the future we can re-open this issue and take another swing at it.

QuiteAFoxtrot commented 2 years ago

Sorry - realized it would be more accurate to re-open this and mark it as Docs instead of bugs then we'll close when we link in a PR for this docs update.

If anyone is able to report a working Linux/Wayland/EGL/libGL configuration I'd be happy to add that to our docs too.