Get help from the marimo community

Updated 6 months ago

Running marimo with the 3d image viewer napari?

At a glance

The community member is trying to run the napari 3D image viewer in the marimo environment, but is facing issues. In a classic notebook in VS Code, the napari viewer opens successfully, but when running the same notebook in marimo, the window does not pop up, although the napari viewer icon appears on the screen.

The community members discuss the issue and suggest that it might be related to the qt event loop used by napari. They point to a link explaining the event loop in IPython or Jupyter notebooks, and wonder if it can be incorporated with marimo. Another community member observes that running napari.run() opens the viewer successfully, but blocks the marimo execution until the viewer is closed.

The community members are interested in finding a way to use the napari 3D image viewer without callbacks in the marimo environment, but the maintainer of marimo notes that adding support for the GUI event loop is not a high priority at the moment due to other priorities, although they acknowledge

Useful resources
Hi there!
I was thinking of running marimo with napari.
In a classic notebook in VS Code, I can simply run
Plain Text
pip install "napari[pyqt5]"

Plain Text
import napari
from skimage import data

cells = data.cells3d() 
viewer = napari.view_image(cells, channel_axis=1)

and it opens the viewer for me (screenshot 1)

When I run the same notebook in marimo, I don't get any error, but the window does not pop up. Interestingly though, the napari viewer icon pops at the right side of the screen (and I also get this jumping icon animation), but when I click it, nothing happens (screenshot2). I'm on a MacBook Air M3.
Attachments
image.png
image.png
J
A
4 comments
@Myles Scolnick , @Akshay : I've just reached out to the napari community, and they pointed me to this link explaining their qt event loop https://napari.org/stable/guides/event_loop.html#in-ipython-or-jupyter-notebook
I don't know too much about qt event loops, but maybe you can figure out how to incorperate the event loop with marimo. Would be really fun to use the 3D image viewer napari without callbacks! 🙂
Attachment
image.png
and another observation:
Plain Text
import napari
from skimage import data

cells = data.cells3d()
viewer = napari.view_image(cells, channel_axis=1)
napari.run()

opens the viewer successfully, but also it blocks marimo execution until I close the napari window.
Attachment
840x560.png
Mm interesting — I wasn’t aware that IPython had a gui event loop. I wonder if we can hook into it somehow or otherwise reimplement its API.
@Jan-Hendrik Müller , I've created a GitHub issue to track this: https://github.com/marimo-team/marimo/issues/1986

I don't plan on adding support for the GUI event loop very soon, just because of other priorities, but I certainly see why it's important.
Add a reply
Sign up and join the conversation on Discord