matplotlib / ipympl

Matplotlib Jupyter Integration
https://matplotlib.org/ipympl/
BSD 3-Clause "New" or "Revised" License
1.57k stars 227 forks source link

resize handle does not respond #501

Open stevejpurves opened 1 year ago

stevejpurves commented 1 year ago

Describe the issue

When trying to drag the resize slider, nothing happens, the cursor changes and then gets stuck. After trying to resize the footer text does not appear or update. Reproducing this via thebe

54Qv6ESTxR

Versions

stevejpurves commented 1 year ago

the latest version of ipympl works fine in jupyterlab, but this remain a problem in thebe can this be because nothing is listening for the jupyterResizeEvent and posting the Lumino UnknownSize message? I notice that in voila event listeners are attached when widget are built?

or it this problem more likely to be within ipympl itself? cc @martinRenou

martinRenou commented 1 year ago

I'm wondering if it could be an issue in the communication between the Python process and the JS one, because it's Python that's responsible for resizing. Can you update the plot data with the sliders?

stevejpurves commented 1 year ago

yes, the plot updates ok from sliders, but as soon as I try to resize, all toolbar interactivity and the footer location readout no longer functions.

stevejpurves commented 1 year ago

looking at the open message channel in the network tab I can see js process sending messages ok for:

  1. slider interaction
  2. figure enter/leave, motion_notify, etc...

but as soon as I click on the resize handle, the frontend no longer sends any messages from (2) but interacting with sliders still works and results in messages being sent. it's like an internal error / exception causes the canvas events on the front end to stop working, but with nothing appearing in the js console to indicate an error.

I'll get an interactive example posted somewhere and share the link

martinRenou commented 1 year ago

That's interesting, so it looks like either Matplotlib or ipympl fails at the resize event and then the communication hangs?

Is there any error in the JavaScript console? Also, would you be able to retrieve any error traceback that could have occurred on the Python kernel?

stevejpurves commented 1 year ago

There are no errors in the JS console on resize, but when I connect to a local jupyter server I see various "cannot open comm exceptions". I don't see those when connecting to binder, yet the issue happens in both scenarios. There are no tracebacks in the jupyter output to the command line.

I have deployed example code here: https://github.com/stevejpurves/bug-thebe-ipympl if you follow the steps in (1) on the readme, you'll be able to see the issue.

Note though there are other issues using ipympl and thebe, that are also listed on that readme and reproducible here and this all works in JupyterLab and in the classic notebook, so I am thinking that there is potentially something wrong in the way that thebe is using ipywidgets manager and rendermime, but I cannot see what it is. Also bear in mind that thebe is still loading jupyter-matplotlib via requirejs (does that have an implication?, e.g. the server needs the notebook extension installed?)