Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't seem to work with jupyter notebook #150

Open
cpsievert opened this issue Mar 22, 2022 · 5 comments
Open

Doesn't seem to work with jupyter notebook #150

cpsievert opened this issue Mar 22, 2022 · 5 comments

Comments

@cpsievert
Copy link

cpsievert commented Mar 22, 2022

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:

Screen Shot 2022-03-22 at 2 47 13 PM

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)?

"src": "nbextension/static",

@bryevdv
Copy link
Member

bryevdv commented Mar 22, 2022

@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)

@philippjfr
Copy link
Contributor

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.

@bryevdv
Copy link
Member

bryevdv commented Mar 22, 2022

@philippjfr can you clarify/confirm re: classic notebook expectations?

@cpsievert
Copy link
Author

cpsievert commented Mar 22, 2022

Ah, I see, that fixes it, thanks! A mention on the README would be helpful

@bryevdv
Copy link
Member

bryevdv commented Mar 22, 2022

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants