Closed ianhi closed 2 years ago
I think this was caused by https://github.com/matplotlib/matplotlib/pull/22250/files
Third-parties can still manually instantiate their toolbars the old-fashioned way.
@anntzer I'm a little confused by what you are saying it is that other backends should do? Maybe part of the issue is that ipympl wasn't doing it this way to begin with?
Should we be explicitly creating a toolbar in the figmanager init? The issue there is that I think we'd always first create a webagg toolbra, and then an ipympl toolbar, which seems unneccesary.
or should we be defining the variables _toolmanager_toolbar_class
and _toolbar2_class
?
Sorry, I did not realize there would be subclasses of backend_webagg_core that did not support NavigationToolbar2WebAgg. Fortunately this is easy to fix: we can simply move the definition of _toolbar2_class (which third parties shouldn't have to mess with) to backend_webagg.
Does
diff --git i/lib/matplotlib/backends/backend_webagg.py w/lib/matplotlib/backends/backend_webagg.py
index bb18c993bd..7359ebdb7a 100644
--- i/lib/matplotlib/backends/backend_webagg.py
+++ w/lib/matplotlib/backends/backend_webagg.py
@@ -51,6 +51,10 @@ class FigureCanvasWebAgg(core.FigureCanvasWebAggCore):
pass
+class FigureManagerWebAgg(core.FigureManagerWebAgg):
+ _toolbar2_class = core.NavigationToolbar2WebAgg
+
+
class WebAggApplication(tornado.web.Application):
initialized = False
started = False
@@ -299,7 +303,7 @@ def ipython_inline_display(figure):
@_Backend.export
class _BackendWebAgg(_Backend):
FigureCanvas = FigureCanvasWebAgg
- FigureManager = core.FigureManagerWebAgg
+ FigureManager = FigureManagerWebAgg
@staticmethod
def show():
diff --git i/lib/matplotlib/backends/backend_webagg_core.py w/lib/matplotlib/backends/backend_webagg_core.py
index 8b5f1ba479..286305f1ca 100644
--- i/lib/matplotlib/backends/backend_webagg_core.py
+++ w/lib/matplotlib/backends/backend_webagg_core.py
@@ -453,7 +453,7 @@ class NavigationToolbar2WebAgg(backend_bases.NavigationToolbar2):
class FigureManagerWebAgg(backend_bases.FigureManagerBase):
- _toolbar2_class = ToolbarCls = NavigationToolbar2WebAgg
+ ToolbarCls = NavigationToolbar2WebAgg
def __init__(self, canvas, num):
self.web_sockets = set()
fix the problem for you? (I left ToolbarCls which is now unused; it can be separately deprecated on Matplotlib's side.
Unfortunately it does not, it shifts the error message to javascript as there is still something going wrong with the toolbar init ( possibly it's not being properly created?
Error: Could not create a view for model id 9f1cdea047f24bd3a7d382e53df7f119
y http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view/e.state_change< http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js:1
display_model http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js:1
renderModel http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/523.fa256ee012d38a89b65a.js:1
createRenderedMimetype http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
createOutputItem http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_createOutput http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_insertOutput http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
onModelChanged http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
m http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
l http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
emit http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_onListChanged http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
m http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
l http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
emit http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
push http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_add http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
add http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_onIOPub http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_handleIOPub http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
handleMsg http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_handleMessage http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_msgChain http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise callback*19883/b/this._onWSMessage http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_createSocket http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
b http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
connectTo http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_connectToKernel http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
setupKernel http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
a http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
connectTo http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_initialize http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
[272.2a8425db7209008188fc.js:1:2107](http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js)
Error: Could not create view
y http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.display_model http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js:1
renderModel http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/523.fa256ee012d38a89b65a.js:1
createRenderedMimetype http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
createOutputItem http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_createOutput http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_insertOutput http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
onModelChanged http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
m http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
l http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
emit http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_onListChanged http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
m http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
l http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
emit http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
push http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_add http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
add http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_onIOPub http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_handleIOPub http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
handleMsg http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_handleMessage http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_msgChain http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise callback*19883/b/this._onWSMessage http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_createSocket http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
b http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
connectTo http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_connectToKernel http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
setupKernel http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
a http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
connectTo http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_initialize http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
[272.2a8425db7209008188fc.js:1:2107](http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js)
TypeError: e is null
create_view 272.2a8425db7209008188fc.js:1
create_child_view 272.2a8425db7209008188fc.js:1
_init_toolbar mpl_widget.js:363
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
_init_toolbar mpl_widget.js:362
render mpl_widget.js:265
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
render mpl_widget.js:256
state_change 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view/e.state_change< 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view 272.2a8425db7209008188fc.js:1
display_model 272.2a8425db7209008188fc.js:1
renderModel 523.fa256ee012d38a89b65a.js:1
createRenderedMimetype jlab_core.1ad82bcd8c48e07a8392.js:2
createOutputItem jlab_core.1ad82bcd8c48e07a8392.js:2
_createOutput jlab_core.1ad82bcd8c48e07a8392.js:2
_insertOutput jlab_core.1ad82bcd8c48e07a8392.js:2
onModelChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
_onListChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
push jlab_core.1ad82bcd8c48e07a8392.js:2
_add jlab_core.1ad82bcd8c48e07a8392.js:2
add jlab_core.1ad82bcd8c48e07a8392.js:2
_onIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
_handleIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
handleMsg jlab_core.1ad82bcd8c48e07a8392.js:2
_handleMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_msgChain jlab_core.1ad82bcd8c48e07a8392.js:2
promise callback*19883/b/this._onWSMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_createSocket jlab_core.1ad82bcd8c48e07a8392.js:2
b jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_connectToKernel jlab_core.1ad82bcd8c48e07a8392.js:2
setupKernel jlab_core.1ad82bcd8c48e07a8392.js:2
a jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_initialize jlab_core.1ad82bcd8c48e07a8392.js:2
[523.fa256ee012d38a89b65a.js:1:1365](http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/523.fa256ee012d38a89b65a.js)
Error: Could not process update msg for model id: 9f1cdea047f24bd3a7d382e53df7f119
y http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js:1
promise callback*2272/t.prototype._handle_comm_msg http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js:1
_handleCommMsg http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_handleMessage http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_msgChain http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise callback*19883/b/this._onWSMessage http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_createSocket http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
b http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
connectTo http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_connectToKernel http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
setupKernel http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
a http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
connectTo http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_initialize http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
initialize http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_populate http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise callback*_populate http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
_revert http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise callback*_revert http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
initialize http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
d http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise callback*_createOrOpenDocument http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
open http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
openOrReveal http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
execute http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise callback*execute http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
execute http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
l http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
restore http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
restore http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
restore http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
G http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
promise callback*80885/e.prototype.activatePlugin http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
resolveRequiredService http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
r http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
activatePlugin http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
resolveRequiredService http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
r http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
activatePlugin http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
o http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
start http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392:2
q http://localhost:8888/static/lab/1641.3470f2cec8db5fe852b8.js?v=3470f2cec8db5fe852b8:1
e http://localhost:8888/static/lab/main.6a79e58dd27a8ac2a02b.js?v=6a79e58dd27a8ac2a02b:1
37559 http://localhost:8888/static/lab/main.6a79e58dd27a8ac2a02b.js?v=6a79e58dd27a8ac2a02b:1
a http://localhost:8888/static/lab/main.6a79e58dd27a8ac2a02b.js?v=6a79e58dd27a8ac2a02b:1
<anonymous> http://localhost:8888/static/lab/main.6a79e58dd27a8ac2a02b.js?v=6a79e58dd27a8ac2a02b:1
<anonymous> http://localhost:8888/static/lab/main.6a79e58dd27a8ac2a02b.js?v=6a79e58dd27a8ac2a02b:1
[272.2a8425db7209008188fc.js:1:2107](http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js)
Uncaught (in promise) TypeError: e is null
create_view 272.2a8425db7209008188fc.js:1
create_child_view 272.2a8425db7209008188fc.js:1
_init_toolbar mpl_widget.js:363
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
_init_toolbar mpl_widget.js:362
render mpl_widget.js:265
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
render mpl_widget.js:256
state_change 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view/e.state_change< 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view 272.2a8425db7209008188fc.js:1
display_model 272.2a8425db7209008188fc.js:1
renderModel 523.fa256ee012d38a89b65a.js:1
createRenderedMimetype jlab_core.1ad82bcd8c48e07a8392.js:2
createOutputItem jlab_core.1ad82bcd8c48e07a8392.js:2
_createOutput jlab_core.1ad82bcd8c48e07a8392.js:2
_insertOutput jlab_core.1ad82bcd8c48e07a8392.js:2
onModelChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
_onListChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
push jlab_core.1ad82bcd8c48e07a8392.js:2
_add jlab_core.1ad82bcd8c48e07a8392.js:2
add jlab_core.1ad82bcd8c48e07a8392.js:2
_onIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
_handleIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
handleMsg jlab_core.1ad82bcd8c48e07a8392.js:2
_handleMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_msgChain jlab_core.1ad82bcd8c48e07a8392.js:2
promise callback*19883/b/this._onWSMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_createSocket jlab_core.1ad82bcd8c48e07a8392.js:2
b jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_connectToKernel jlab_core.1ad82bcd8c48e07a8392.js:2
setupKernel jlab_core.1ad82bcd8c48e07a8392.js:2
a jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_initialize jlab_core.1ad82bcd8c48e07a8392.js:2
[272.2a8425db7209008188fc.js:1:6561](http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js)
Uncaught (in promise) TypeError: e is null
create_view 272.2a8425db7209008188fc.js:1
create_child_view 272.2a8425db7209008188fc.js:1
_init_toolbar mpl_widget.js:363
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
_init_toolbar mpl_widget.js:362
render mpl_widget.js:265
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
render mpl_widget.js:256
state_change 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view/e.state_change< 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view 272.2a8425db7209008188fc.js:1
display_model 272.2a8425db7209008188fc.js:1
renderModel 523.fa256ee012d38a89b65a.js:1
createRenderedMimetype jlab_core.1ad82bcd8c48e07a8392.js:2
createOutputItem jlab_core.1ad82bcd8c48e07a8392.js:2
_createOutput jlab_core.1ad82bcd8c48e07a8392.js:2
_insertOutput jlab_core.1ad82bcd8c48e07a8392.js:2
onModelChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
_onListChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
push jlab_core.1ad82bcd8c48e07a8392.js:2
_add jlab_core.1ad82bcd8c48e07a8392.js:2
add jlab_core.1ad82bcd8c48e07a8392.js:2
_onIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
_handleIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
handleMsg jlab_core.1ad82bcd8c48e07a8392.js:2
_handleMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_msgChain jlab_core.1ad82bcd8c48e07a8392.js:2
promise callback*19883/b/this._onWSMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_createSocket jlab_core.1ad82bcd8c48e07a8392.js:2
b jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_connectToKernel jlab_core.1ad82bcd8c48e07a8392.js:2
setupKernel jlab_core.1ad82bcd8c48e07a8392.js:2
a jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_initialize jlab_core.1ad82bcd8c48e07a8392.js:2
[272.2a8425db7209008188fc.js:1:6561](http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js)
Uncaught (in promise) TypeError: e is null
create_view 272.2a8425db7209008188fc.js:1
create_child_view 272.2a8425db7209008188fc.js:1
_init_toolbar mpl_widget.js:363
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
_init_toolbar mpl_widget.js:362
render mpl_widget.js:265
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
render mpl_widget.js:256
state_change 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view/e.state_change< 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view 272.2a8425db7209008188fc.js:1
display_model 272.2a8425db7209008188fc.js:1
renderModel 523.fa256ee012d38a89b65a.js:1
createRenderedMimetype jlab_core.1ad82bcd8c48e07a8392.js:2
createOutputItem jlab_core.1ad82bcd8c48e07a8392.js:2
_createOutput jlab_core.1ad82bcd8c48e07a8392.js:2
_insertOutput jlab_core.1ad82bcd8c48e07a8392.js:2
onModelChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
_onListChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
push jlab_core.1ad82bcd8c48e07a8392.js:2
_add jlab_core.1ad82bcd8c48e07a8392.js:2
add jlab_core.1ad82bcd8c48e07a8392.js:2
_onIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
_handleIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
handleMsg jlab_core.1ad82bcd8c48e07a8392.js:2
_handleMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_msgChain jlab_core.1ad82bcd8c48e07a8392.js:2
promise callback*19883/b/this._onWSMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_createSocket jlab_core.1ad82bcd8c48e07a8392.js:2
b jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_connectToKernel jlab_core.1ad82bcd8c48e07a8392.js:2
setupKernel jlab_core.1ad82bcd8c48e07a8392.js:2
a jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_initialize jlab_core.1ad82bcd8c48e07a8392.js:2
[272.2a8425db7209008188fc.js:1:6561](http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js)
Source map error: Error: request failed with status 404
Resource URL: http://localhost:8888/static/lab/1641.3470f2cec8db5fe852b8.js?v=3470f2cec8db5fe852b8
Source Map URL: 1641.3470f2cec8db5fe852b8.js.map?v=3470f2cec8db5fe852b8
Source map error: Error: request failed with status 404
Resource URL: http://localhost:8888/static/lab/main.6a79e58dd27a8ac2a02b.js?v=6a79e58dd27a8ac2a02b
Source Map URL: main.6a79e58dd27a8ac2a02b.js.map?v=6a79e58dd27a8ac2a02b
Uncaught (in promise) TypeError: e is null
create_view 272.2a8425db7209008188fc.js:1
create_child_view 272.2a8425db7209008188fc.js:1
_init_toolbar mpl_widget.js:363
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
_init_toolbar mpl_widget.js:362
render mpl_widget.js:265
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
render mpl_widget.js:256
state_change 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view/e.state_change< 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view 272.2a8425db7209008188fc.js:1
display_model 272.2a8425db7209008188fc.js:1
renderModel 523.fa256ee012d38a89b65a.js:1
createRenderedMimetype jlab_core.1ad82bcd8c48e07a8392.js:2
createOutputItem jlab_core.1ad82bcd8c48e07a8392.js:2
_createOutput jlab_core.1ad82bcd8c48e07a8392.js:2
_insertOutput jlab_core.1ad82bcd8c48e07a8392.js:2
onModelChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
_onListChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
push jlab_core.1ad82bcd8c48e07a8392.js:2
_add jlab_core.1ad82bcd8c48e07a8392.js:2
add jlab_core.1ad82bcd8c48e07a8392.js:2
_onIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
_handleIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
handleMsg jlab_core.1ad82bcd8c48e07a8392.js:2
_handleMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_msgChain jlab_core.1ad82bcd8c48e07a8392.js:2
promise callback*19883/b/this._onWSMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_createSocket jlab_core.1ad82bcd8c48e07a8392.js:2
b jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_connectToKernel jlab_core.1ad82bcd8c48e07a8392.js:2
setupKernel jlab_core.1ad82bcd8c48e07a8392.js:2
a jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_initialize jlab_core.1ad82bcd8c48e07a8392.js:2
[272.2a8425db7209008188fc.js:1:6561](http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.2a8425db7209008188fc.js)
Kernel: restarting (8f7f6910-ee6d-434d-8f4c-44743910b0c0) [jlab_core.1ad82bcd8c48e07a8392.js:2:927850](http://localhost:8888/static/lab/jlab_core.1ad82bcd8c48e07a8392.js?v=1ad82bcd8c48e07a8392)
Uncaught (in promise) TypeError: e is null
create_view 272.2a8425db7209008188fc.js:1
create_child_view 272.2a8425db7209008188fc.js:1
_init_toolbar mpl_widget.js:363
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
_init_toolbar mpl_widget.js:362
render mpl_widget.js:265
__awaiter mpl_widget.js:7
__awaiter mpl_widget.js:3
render mpl_widget.js:256
state_change 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view/e.state_change< 272.2a8425db7209008188fc.js:1
promise callback*2272/e.prototype.create_view 272.2a8425db7209008188fc.js:1
display_model 272.2a8425db7209008188fc.js:1
renderModel 523.fa256ee012d38a89b65a.js:1
createRenderedMimetype jlab_core.1ad82bcd8c48e07a8392.js:2
createOutputItem jlab_core.1ad82bcd8c48e07a8392.js:2
_createOutput jlab_core.1ad82bcd8c48e07a8392.js:2
_insertOutput jlab_core.1ad82bcd8c48e07a8392.js:2
onModelChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
_onListChanged jlab_core.1ad82bcd8c48e07a8392.js:2
m jlab_core.1ad82bcd8c48e07a8392.js:2
l jlab_core.1ad82bcd8c48e07a8392.js:2
emit jlab_core.1ad82bcd8c48e07a8392.js:2
push jlab_core.1ad82bcd8c48e07a8392.js:2
_add jlab_core.1ad82bcd8c48e07a8392.js:2
add jlab_core.1ad82bcd8c48e07a8392.js:2
_onIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
_handleIOPub jlab_core.1ad82bcd8c48e07a8392.js:2
handleMsg jlab_core.1ad82bcd8c48e07a8392.js:2
_handleMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_msgChain jlab_core.1ad82bcd8c48e07a8392.js:2
promise callback*19883/b/this._onWSMessage jlab_core.1ad82bcd8c48e07a8392.js:2
_createSocket jlab_core.1ad82bcd8c48e07a8392.js:2
b jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_connectToKernel jlab_core.1ad82bcd8c48e07a8392.js:2
setupKernel jlab_core.1ad82bcd8c48e07a8392.js:2
a jlab_core.1ad82bcd8c48e07a8392.js:2
connectTo jlab_core.1ad82bcd8c48e07a8392.js:2
_initialize jlab_core.1ad82bcd8c48e07a8392.js:2
@anntzer it seems that that patch results in the toolbar being None
(which is the cause of those awful js errors)
%matplotlib widget
import matplotlib.pyplot as plt
import numpy as np
with plt.ioff():
fig = plt.figure()
plt.plot(np.sin(np.linspace(0, 20, 100)));
print(fig.canvas.toolbar is None)
gives True
Ah, I see, you were relying on the ToolbarCls mechanism. I guess I need to have a proper deprecation for it, although that looks tricky :/
In any case, you should (on top of the patch above) get rid of the ToolbarCls = Toolbar
line and add self.toolbar = Toolbar(self.canvas)
to your FigureManager init (e.g. after the super-init).
Doing that results in a non-None toolbar with your example, although it is still not getting displayed for me (but perhaps you'll have a better idea?). How do you get to see the js errors?
How do you get to see the js errors?
You open the browser console instructions for various browsers here: https://balsamiq.com/support/faqs/browserconsole/
oh! the reason it's not being displayed is probably because of the ioff
. Which I put there to prevent display and thus isolate the js errors.
ah self.toolbar = Toolbar(self.canvas)
seems to fix it (in combination with the patch to webagg_core
). Thanks!
We can release an update with this fix soon (assuming compatible with old versions of mpl) - but would still be good to have a deprecation period.
Can you quickly check the compat with older Matplotlibs?
I can get this working on mpl main (with the above patch) and on 3.4
if I bring back ToolbarCls
and also manually init the toolbar
maybe this (with the check on version) is better?
diff --git a/ipympl/backend_nbagg.py b/ipympl/backend_nbagg.py
index 15813bb..e740cef 100644
--- a/ipympl/backend_nbagg.py
+++ b/ipympl/backend_nbagg.py
@@ -452,11 +452,13 @@ class Canvas(DOMWidget, FigureCanvasWebAggCore):
class FigureManager(FigureManagerWebAgg):
- ToolbarCls = Toolbar
+ if matplotlib.__version__ < "3.6":
+ ToolbarCls = Toolbar
def __init__(self, canvas, num):
FigureManagerWebAgg.__init__(self, canvas, num)
self.web_sockets = [self.canvas]
+ self.toolbar = Toolbar(self.canvas)
def show(self):
if self.canvas._closed:
Seems good to me.
@ianhi Sorry I dropped the ball on this. Is there anything specific left to be done on Matplotlib's side (e.g. some deprecation? under does it need to be displayed?) (AFAICT mpl HEAD now works just fine even with ipympl 0.8.7 i.e. before fixing anything on your side.)
@ianhi Sorry I dropped the ball on this.
I don't think you did? All seems well for the forseeable future
AFAICT mpl HEAD now works just fine even with ipympl 0.8.7 i.e. before fixing anything on your side.)
interesting. Did more things change after https://github.com/matplotlib/matplotlib/pull/22454?
Either way it seems that our tests will pick this up again in the future if it becomes an issue once more so I don't see a big need to make more changes given that everything currently works
I don't think you did? All seems well for the forseeable future
Mostly I thought I promised to add a deprecation path somewhere but didn't do it. Let's just leave things as they are and feel free to ping again if needed.
Describe the issue
For example see: https://github.com/matplotlib/ipympl/actions/runs/1806282769
Getting a lot of these errors so something must have changed upstream w.r.t colorbars i suppose