HoloViews interferes with %gui qt event loops in Jupyter notebooks -- is there a way to avoid this?

I’m trying to use HoloViews to analyze non-image data interactively while also using separate frameworks to analyze image data interactively (namely, napari, but this is a more generic issue). It seems that any code that uses the %gui qt cell magic as well as uses HoloViews to display data will encounter issues with when the interpreter reads and executes cells. For example, the simple code below, when separated into cells as marked, leads to a problem where cells won’t be run until the next desired cell is executed (which gets very annoying very quickly):

%gui qt
2+2

(This returns 4)
Now run:

import holoviews as hv
hv.extension('bokeh')

followed by

2+2

This next cell hangs! But if you place a blank cell after it and execute the blank cell, the preceding cell will be executed (returning 4) and the blank cell will behave as if it’s running.

Is there a way to make both interactive elements usable? It would be awesome to be able to do both, because the two toolkits complement each other very nicely, but I don’t know enough about Qt, IPython, HoloViews, or the event loops themselves to be able to figure this out…

I raised an issue on the napari GitHub before learning that this is a generic issue with HoloViews, to read more about my original question you can go here: https://github.com/napari/napari/issues/3892

1 Like

Thanks for reporting this. Can you file this as an issue with Panel?

1 Like

I will, though if you wouldn’t mind explaining for those of us who don’t understand the HoloViz environment in its totality (to be honest, it’s pretty intimidating): how does this have to do with Panel? I followed the source enough to see that this comes from some function in the PyViz_Comm package… presumably this gets chased down to an issue in Panel somewhere, but I can’t find where the HoloViews documentation explains what exactly is going on with the extension call.