Get help from the marimo community

Updated 4 months ago

Running marimo with the 3d image viewer napari?

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