Closed Linusnie closed 1 year ago
@Linusnie are you using ipympl in vscode or in jupyterlab?
@Linusnie are you using ipympl in vscode or in jupyterlab?
I'm using jupyterlab
Ok great. Two follow up questions:
sure! There's quite a bit of output in the console, most relevant might be this one: Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason: Control comm was closed too early
? (last image)
in case it's relevant, things like ipywidgets.IntSlider(10)
works and I can interact with no issue
Update: looks like the problem is caused by an incompatibility with matplotlib. If I try the same notebook in vs code it prints out the following error message when I try to use the plot (not sure why it doesn't show up when using jupyterlab).
KeyError Traceback (most recent call last)
File ~/workspace/convex_relaxations/venv3.10/lib/python3.10/site-packages/ipympl/backend_nbagg.py:279, in Canvas._handle_message(self, object, content, buffers)
276 self.manager.handle_json(content)
278 else:
--> 279 self.manager.handle_json(content)
File ~/workspace/convex_relaxations/venv3.10/lib/python3.10/site-packages/matplotlib/backends/backend_webagg_core.py:462, in FigureManagerWebAgg.handle_json(self, content)
461 def handle_json(self, content):
--> 462 self.canvas.handle_event(content)
File ~/workspace/convex_relaxations/venv3.10/lib/python3.10/site-packages/matplotlib/backends/backend_webagg_core.py:266, in FigureCanvasWebAggCore.handle_event(self, event)
263 e_type = event['type']
264 handler = getattr(self, 'handle_{0}'.format(e_type),
265 self.handle_unknown_event)
--> 266 return handler(event)
File ~/workspace/convex_relaxations/venv3.10/lib/python3.10/site-packages/matplotlib/backends/backend_webagg_core.py:293, in FigureCanvasWebAggCore._handle_mouse(self, event)
290 button = event['button'] + 1
292 e_type = event['type']
--> 293 modifiers = event['modifiers']
294 guiEvent = event.get('guiEvent')
295 if e_type in ['button_press', 'button_release']:
KeyError: 'modifiers'
After downgrading matplotlib using python -m pip install matplotlib==3.6.2
zooming and moving works as usual
Ahh indeed broken for the new matplotlib. Thank you for reporting!
f I try the same notebook in vs code it prints out the following error message when I try to use the plot (not sure why it doesn't show up when using jupyterlab).
You can see the errors by going View> Show Log Console
and changing thelevel to info
I think the breakage is caused by https://github.com/matplotlib/matplotlib/pull/23473 which requires us to add modifiers to events from javascript side, because we don't rely on mpl.js we did pick up the changes from that side, only the python side.
Thanks again for reporting @Linusnie ! The fix has been merged, trying to remember how to make a release now - once that's done version 0.9.3
and up should work with latest matplotlib
@Linusnie should be fixed in the now release version 0.9.3
@ianhi awesome! thanks for the quick response
Is it really fixed? ipympl=0.9.3
with matplotlib=3.7.0
still get the same error.
After installing jupyterlab and ipympl I'm able to make plots that can be displayed and resized, but the move and zoom buttons don't work. Tooltips are shown if I hover the cursor over the buttons, but clicking them gives no response.
I also posted in https://github.com/matplotlib/ipympl/issues/70 which was closed as outdated
package versions:
jupyter labextension list
returns the following: