holoviews: BokehJS library missing; plots won't show in jlab

This is in a fresh environment, just set up with conda install -c holoviz hvplot and installing the jupyterlab comms with jupyter labextension install @pyviz/jupyterlab_pyviz. This echoes this from stack overflow, but I see it wasn’t tagged with holoviews: https://stackoverflow.com/questions/66474476/bokehjs-library-missing-error-and-no-plot

ALL software version info

holoviews 1.14.2 bokeh 2.3.0 hvplot 0.7.1 jupyterlab 2.2.6 mac OS 10.14.6 chrome 88.0.4324.182

Description of expected behavior and the observed behavior

Expected that plots show up.

Complete, minimal, self-contained example code that reproduces the issue

import hvplot.pandas
import pandas as pd
import numpy as np

df = pd.DataFrame({'x': np.random.random(100), 'y': np.random.random(100)})
df.hvplot('x', 'y')

Stack traceback and/or browser JavaScript console output

index.es6.js:211 Error: Cannot send
    at a.send (comm.js:119)
    at l._disposePlot (renderer.js:192)
    at l.dispose (renderer.js:215)
    at t.dispose (index.es6.js:2599)
    at t.e.dispose (index.es6.js:919)
    at _clear (widget.js:298)
    at _.onModelChanged (widget.js:223)
    at m (index.es6.js:459)
    at Object.c [as emit] (index.es6.js:416)
    at e.emit (index.es6.js:99)
JGtG.t.exceptionHandler @ index.es6.js:211
m @ index.es6.js:462
c @ index.es6.js:416
e.emit @ index.es6.js:99
_onListChanged @ model.js:231
m @ index.es6.js:459
c @ index.es6.js:416
e.emit @ index.es6.js:99
clear @ observablelist.js:238
clear @ model.js:144
clearExecution @ model.js:311
t @ widget.js:781
a @ actions.js:1341
(anonymous) @ actions.js:1292
o @ actions.js:1292
d @ actions.js:399
execute @ index.js:690
e.execute @ index.es6.js:357
e._executeKeyBinding @ index.es6.js:517
e.processKeydownEvent @ index.es6.js:456
e.evtKeydown @ index.es6.js:355
e.handleEvent @ index.es6.js:311
VM861:19 Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Just updating panel wasn’t working for me, but I think I wasn’t getting the newest version, probably due to something else requiring an older one. I ran conda update --all -c pyviz -c conda-forge, as also suggested in #4875 (after also clearing all outputs, clearing cache, and hard reloading), and now things are rendering again.

Following advice in issue #4875 to update panel (conda install panel -c pyviz) seemed to clear up this problem for me. Could be a coincidence?

I have a pretty similar issue I think. In plain jupyter, I get the “Unable to run BokehJS code because BokehJS library is missing” but in jupyterlab I get a warning about python/JS bokeh version and then an error:

VM19062:287 [bokeh] JS/Python version mismatch
VM19062:287 [bokeh] Library versions: JS (2.2.3) / Python (2.3.0)
VM19062:288 Uncaught Error: Model 'AllLabels' does not exist. This could be due to a widget or a custom model not being registered before first usage.
    at Object.s.Models (<anonymous>:288:204)
    at Function._instantiate_object (<anonymous>:287:4891)
    at Function._instantiate_references_json (<anonymous>:287:5050)
    at Function.from_json (<anonymous>:287:8363)
    at Object.t.embed_items_notebook (<anonymous>:700:2975)
    at embed_document (<anonymous>:5:22)
    at <anonymous>:8:5
    at <anonymous>:24:3
    at t.attachWidget (index.es6.js:2758)
    at t.insertWidget (index.es6.js:2661)

That specific version of the jupyterlab extension doesn’t work for me, saying it is not compatible with my the current JupyterLab. I assume that is because I am on jupyterlab 1.2.6

UPDATE: I made a new environment with jupyterlab 2 and the pyviz extension above, and can confirm that it works.

EDIT: oddly, I needed to have the two calls to hv.extension in separate cells, but it worked even if both were hv.extension("bokeh"). It even works if I have import holoviews as hv in the first cell then hv.extension("bokeh") in the second cell, but not if I have both in the first cell. I’m also getting Exception opening new comm in the console when trying to use Pipes to send data to a DynamicMap, but I’m not sure if that’s related.

I confirm this behavior. hv.extension("bokeh") must be set in a different cell, then it works, with the latest panel in both jupyter notebook AND jupyter lab.

I was getting this issue again recently, even after creating a new environment that only had holoviews, bokeh, and ipykernel installed. When I put

import holoviews as hv
hv.extension("bokeh")

no plots would show and there was the same error in the console about bokehjs missing. But if I did hv.extension("matplotlib") first then hv.extension("bokeh"), the plots would work. Posting in case this helps anybody else / future me.


EDIT: oddly, I needed to have the two calls to hv.extension in separate cells, but it worked even if both were hv.extension("bokeh"). It even works if I have import holoviews as hv in the first cell then hv.extension("bokeh") in the second cell, but not if I have both in the first cell. I’m also getting Exception opening new comm in the console when trying to use Pipes to send data to a DynamicMap, but I’m not sure if that’s related.

Just wanted to add - I produced same error and issue when updating to bokeh 2.3.0/panel 0.11.1/holoviews 1.14.2, and I followed these steps here (updating panel to the pyviz channel, clearing output and notebooks, restarting kernels, reloading the page) made my plots start showing up correctly in JupterLab, however the interaction/widget use in a panel dashboard was still broken and unresponsive. I had to re-install the @pyviz/jupyterlab_pyviz extension in order for widgets to start responding again. Thanks

A lot of the issues here are likely down to old versions of Bokeh sticking around in a notebook. So what I’d recommend is:

  1. Clear all open notebooks.
  2. Save the notebook(s)
  3. Reload the JupyterLab/notebook browser page

Also just confirmed that I get the same in plain jupyter notebook rather than jlab.