Napari GL Rendering Error (recent versions only)

Hi,

I recently created a container image (using Singularity) with the latest version of Napari installed. However, I am having trouble getting Napari to successfully launch.

The script I’m running has been verified to work in a different container with a much older version of Napari, v0.2.12. The script itself is pretty simple. It loads an image of a slide via openslide, getting a pyramid with shape [(44885, 79680, 3), (610, 1600, 3), (576, 1024, 3)]. It then loads three classifier output masks, and resizes them to the same pyramidal shape. It finally displays them with viewer.add_{image,labels}().

When I run this script on Napari v0.4.2, however, I get this error:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 825, in paintGL
    self._vispy_canvas.events.draw(region=None)
  File "/opt/conda/lib/python3.8/site-packages/vispy/util/event.py", line 455, in __call__
    self._invoke_callback(cb, event)
  File "/opt/conda/lib/python3.8/site-packages/vispy/util/event.py", line 473, in _invoke_callback
    _handle_exception(self.ignore_callback_errors,
  File "/opt/conda/lib/python3.8/site-packages/vispy/util/event.py", line 471, in _invoke_callback
    cb(event)
  File "/opt/conda/lib/python3.8/site-packages/napari/_qt/qt_viewer.py", line 725, in on_draw
    layer._update_draw(
  File "/opt/conda/lib/python3.8/site-packages/napari/layers/base/base.py", line 954, in _update_draw
    self.refresh()
  File "/opt/conda/lib/python3.8/site-packages/napari/layers/base/base.py", line 897, in refresh
    self.events.set_data()
  File "/opt/conda/lib/python3.8/site-packages/napari/utils/events/event.py", line 513, in __call__
    self._invoke_callback(cb, event)
  File "/opt/conda/lib/python3.8/site-packages/napari/utils/events/event.py", line 530, in _invoke_callback
    _handle_exception(
  File "/opt/conda/lib/python3.8/site-packages/napari/utils/events/event.py", line 528, in _invoke_callback
    cb(event)
  File "/opt/conda/lib/python3.8/site-packages/napari/_vispy/vispy_image_layer.py", line 94, in _on_data_change
    self._set_node_data(self.node, self.layer._data_view)
  File "/opt/conda/lib/python3.8/site-packages/napari/_vispy/vispy_image_layer.py", line 120, in _set_node_data
    data = self.downsample_texture(data, self.MAX_TEXTURE_SIZE_2D)
  File "/opt/conda/lib/python3.8/site-packages/napari/_vispy/vispy_image_layer.py", line 198, in downsample_texture
    raise ValueError(
ValueError: Shape of individual tiles in multiscale (44885, 79680, 3) cannot exceed GL_MAX_TEXTURE_SIZE 8192. Rendering is currently in 2D mode.

The curious thing is, if I set the display resolution of the remote system I’m running this on to 640x480, the error goes away! Unfortunately, it is nearly unusable at such a low resolutions. No higher resolution works.

Any idea what could be causing this?

Hi Arjun, could you open an issue here: https://github.com/napari/napari/issues/new?template=bug_report.md

If you could include:

  • the info you’ve written above (including the error message),
  • a minimal version of the script you used (to open the image and throws an error)
  • an example openslide image to use with your script (could be a link to one that’s already publicly available, or you could upload one somewhere yourself). The important thing is that it should work with your script and show the error message.

Basically, if you can give us enough info to have a minimal, reproducible example then someone can run it and see if we can help you figure this out

1 Like

This seems similar to the issue reported by @jni here: https://github.com/napari/napari/issues/1207