jupyter_bokeh
jupyter_bokeh copied to clipboard
Doesn't seem to work with `jupyter notebook`
After doing pip install jupyter_bokeh
, jupyter notebook
, then running the following in a notebook cell:
from bokeh.plotting import figure
from jupyter_bokeh import BokehModel
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
p = figure(title="Simple line example", x_axis_label="x", y_axis_label="y")
p.line(x, y, legend_label="Temp.", line_width=2)
BokehModel(p)
I get no output and the following JS errors:
Am I doing something wrong? I have a feeling this might be related to the fact that the notebook extension config is pointing to a seemingly non-existant nbextension/static
(should it be nbextension
instead)?
https://github.com/bokeh/jupyter_bokeh/blob/4010f6ce88f37afeadc2118b5c262d9cd0f19855/jupyter_bokeh/init.py#L22
@cpsievert @philippjfr is probably the best person to speculate on this but I will go ahead and say up front that complete version information is needed for all the relevant packages.
Edit: also, just to be clear, AFAIK the jupyter_bokeh
is only needed (and only works with) JupyterLab. Classic notebook still uses the old historical "publish JS to output cells" approach that was always used with classic notebook, and as a result is limited to the things that have historically been supported that way. Any specialized features of the jupyter_bokeh
extension itself (such as BokehModel
) would not work with classic notebook, in case you are using classic notebook (why it is always important to specify exact version information in all issues)
I believe what's missing here is running bokeh.io.output_notebook()
. We can probably document this better and at least issue a browser console warning if bokeh hasnt been loaded.
@philippjfr can you clarify/confirm re: classic notebook expectations?
Ah, I see, that fixes it, thanks! A mention on the README would be helpful
@cpsievert FYI the docs for everything Bokeh related are consolidated on the main docs site
https://docs.bokeh.org/en/latest/docs/user_guide/jupyter.html