Hi, I am having trouble migrating my code from Jupyter Notebooks to Jupyter Lab. I am trying to dynamically update the glyph features based on my python code. In notebooks I have been using handles and push_notebook function.
I can’t find the way to achieve the similar behavior in Jupyter Lab.
For example, I would like to change the color to red for the glyphs in the simple example below.
Any help would be appreciated. J
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import ColumnDataSource
from bokeh.io import push_notebook
output_notebook()
p = figure(width=400, height=400)
r = p.circle([1,2,3], [1,2,3])
handle = show(p, notebook_handle=True)
What version of Bokeh? Will have to just try to repro when I get some time, I don’t have any other immediate suggestions (beyond checking the browser JS console for any errors or logs)
Well, that’s definitely the proximate cause. Bokeh update messages go over a Jupyter Comms channel, so if the comm fails to open then for sure things won’t work. I don’t offhand know why comms init would fail, though. I would suggest trying out some older minor revisions of jupyter-lab to see if that makes any difference. Perhaps something changed on the Jupyter side of things recently. Maybe there is also some Jupyter setting or configuration that would afford more detailed error messages.
I went all the way down to the version 3.0.14 of Jupyterlab with no change in behavior. Also, I noticed even more descriptive error that is displayed right after I start the Jupyter in the browser:
Plugin '@bokeh/jupyter_bokeh' failed to activate. jlab_core.1d4a092221669bba35bb.js:2:1351476
o http://localhost:8888/static/lab/jlab_core.1d4a092221669bba35bb.js?v=1d4a092221669bba35bb:2
(Async: promise callback)
o http://localhost:8888/static/lab/jlab_core.1d4a092221669bba35bb.js?v=1d4a092221669bba35bb:2
start http://localhost:8888/static/lab/jlab_core.1d4a092221669bba35bb.js?v=1d4a092221669bba35bb:2
G http://localhost:8888/static/lab/7796.1d8cb0bc59e275d6464f.js?v=1d8cb0bc59e275d6464f:1
e http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
37559 http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
a http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
<anonymous> http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
<anonymous> http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
Error: No provider for: jupyter.extensions.jupyterWidgetRegistry.
resolveRequiredService http://localhost:8888/static/lab/jlab_core.1d4a092221669bba35bb.js?v=1d4a092221669bba35bb:2
r http://localhost:8888/static/lab/jlab_core.1d4a092221669bba35bb.js?v=1d4a092221669bba35bb:2
activatePlugin http://localhost:8888/static/lab/jlab_core.1d4a092221669bba35bb.js?v=1d4a092221669bba35bb:2
o http://localhost:8888/static/lab/jlab_core.1d4a092221669bba35bb.js?v=1d4a092221669bba35bb:2
start http://localhost:8888/static/lab/jlab_core.1d4a092221669bba35bb.js?v=1d4a092221669bba35bb:2
G http://localhost:8888/static/lab/7796.1d8cb0bc59e275d6464f.js?v=1d8cb0bc59e275d6464f:1
e http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
37559 http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
a http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
<anonymous> http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
<anonymous> http://localhost:8888/static/lab/main.9907354c68bf45c5d68c.js?v=9907354c68bf45c5d68c:1
jlab_core.1d4a092221669bba35bb.js:2:1351528
It happens on firefox 104 (snap and appimage) and chromium as well on both Ubuntu 22.04 and Windows 10. So it seems I am missing something global here.