No output in jupyter.
ALL software version info
bokeh==3.3.2 holoviews==1.18.1 hvplot==0.9.0 jupyterlab==4.0.9 jupyterlab-widgets==3.0.9 jupyterlab_pygments==0.3.0 jupyterlab_server==2.25.2 panel==1.3.6
Python 3.10.12
Linux Kernel: 6.6.6-76060606-generic
Description of expected behavior and the observed behavior
Expecting hvplot to work in jupyter...
Complete, minimal, self-contained example code that reproduces the issue
import pandas as pd
import hvplot.pandas
import numpy as np
df = pd.DataFrame({'x':range(100), 'y': np.linspace(0,100,100)})
df.hvplot.line(x='x',y='y')
Stack traceback and/or browser JavaScript console output
In the web console in jupyter:
TypeError: Bokeh is undefined
Panel: ERROR: Unable to run Panel code because Bokeh or Panel library is missing
Screenshots or screencasts of the bug in action
No output:
However, if I refresh the web page on jupyter then I now see output:
I downgraded from holoviews 1.18.1 to 1.18.0 and bokeh from bokeh from 3.3.2 to 3.3.1 and things are currently working.
I have the same problem, but downgrading did not resolve the issue for me.
Refreshing the page appears to work occasionally. When it does (I do not know what triggers it?!) plotting hv elements in panels works for a while, but eventually disappear...
It is likely some old js cache that messes things up.
Try the following steps.
- Clear the notebook and save.
- Close all the notebooks.
- Hard refresh the browser.
Hi @ea42gh could you report whether following the steps suggest by @Hoxbro fixed your issue? I agree it's likely an issue with some cache. If you're using JupyterLab, you may also want to make sure you don't have multiple notebooks opened at the same time that run with various versions of Bokeh.
@Hoxbro What do you mean by Clear the notebook and save?
@Hoxbro I guess you mean Edit -> Clear Outputs of All Cells
The issue recurred for me with the downgraded versions.
I followed @Hoxbro steps and it did resolve the issue.
Just saw these messages: The cache issue had occurred to me, but not the multiple notebook views.
- I stopped all the running kernels
- I cleared the cache
- I restarted a single notebook without refreshing the browser
Currently, it displays the hv graphs when I execute a cell. I'll continue experimenting. Maybe I can figure out how to get this to fail reliably...
I forgot to mention. This bug is only with plotly and holoviews backends not with matplotlib.
Additional observation: The solution put forward by @Hoxbro seems to have stopped working for me. However, the solution from @ea42gh is resolving the issue for me. To make it clear the following is working:
- Kernel Tab -> Shut Down All Kernels
- Close all notebooks
- Hard Refresh Browser
- Open Notebook
- Restart Kernel on Notebook
We also experienced the issue here. I'm not sure if we had more of that one or more of the CORS header issue (we are not in webdev business so no-one locally is really able to debug these things), but the end result is that we have been plagued with plots disappearing all the time. Is there a way to programmatically clear those caches somehow from some Python code ? At this point we probably care a lot less about load time than just being able to see the plot.
This all sounds incredibly frustrating. I'm taking another deep look at this today, if someone has a reproducible way to trigger these issues I'd be very grateful.
I managed to reproduce it by:
- creating a basic notebook that just does one plot:
import holoviews as hv
hv.extension('bokeh', inline=True)
hv.Curve([1,2])
- Do not close the jupyter server
- in the same venv, force install an older bokeh (I used
3.2.0) - Make a new notebook with the same code and run it in the same jupyterlab instance as the previous notebook.
- Plot should not show in that 2nd notebook
I found that the issue is that window.Bokeh.Panel is null. The path I hit is this line:
https://github.com/holoviz/panel/blob/b36ec0cc829b3c00209886bec66c80377122b756/panel/_templates/doc_nb_js.js#L29
My current theory is that this Bokeh.versions.get(py_version) call does not initialize Bokeh.Panel properly. When I assign it the existing window.Bokeh.Panel object, I end up (unsurprisingly) with errors down the line:
Uncaught Error: could not resolve type 'panel.models.browser.BrowserInfo', which could be due to a widget or a custom model not being registered before first usage
At some point I ran:
import panel as pn
pn.extension()
And now I can't reproduce the issue anymore, even after clearing caches and cookies.
I just encountered this; I suspect this is a cache thing.
I'm usually working on Panel >= 1.4.0, but had to work on a pinned Panel == 1.3.8. Following these steps made it work for me.
Clear the notebook and save. Close all the notebooks. Hard refresh the browser.
I've run into this issue now with bokeh-3.4.0, holoviews-1.18.3, panel-1.4.2. Specifically, when opening a notebook the plots are there at first, but if I run a cell that should display a plot then nothing shows up except the TypeError: Bokeh is undefined message in the JS console. A combination of refresh and close / reopen seems to sometimes manage getting the plots visible, but this is completely impractical for the Jupyter workflow.
Downgrading to bokeh-3.3.0, holoviews-1.18.3, panel-1.4.2 has made it work again for me at the moment without the shenanigans, but that's clearly not satisfying either.
This still occurs: https://discord.com/channels/1075331058024861767/1088157184489164831/1273669842473320579
This still occurs: https://discord.com/channels/1075331058024861767/1088157184489164831/1273669842473320579
@Coderambling, yes. This issue is still open and this PR https://github.com/holoviz/hvplot/pull/1359 with a potential fix has not yet been merged. Please refrain from bumping issues with messages of this kind, they're unfortunately not very helpful and cause noise (at least everyone in this issue and the maintainers will all get a notification).