Streams apparently not working in Jupyter Lab

Hello,

we’ve run into an issue with using streams and DynamicMap in a Jupyter Lab notebook. It seems like the examples from your website do not work in Jupyter. Additionally we’ve tried setting up our own M(not)WE which looks as follows:

import holoviews as hv
from holoviews import streams
import hvplot.pandas
import pandas as pd
import numpy as np
hv.extension("bokeh")

def callback(index):
    r = np.random.rand()
    return hv.Text(x=1,y=1, text=f"{r}: {index}")

mwe_df = pd.DataFrame(np.random.normal(size=(100, 2)), columns=["x", "y"])
plot = mwe_df.hvplot(x="x", y="y", kind="scatter", tools=["tap"])
selection_stream = streams.Selection1D(source=plot)
dynmap = hv.DynamicMap(callback, streams=[selection_stream])
overlay = dynmap * plot
overlay

(the above is code executed in a Jupyter Lab cell)

This also does not work. It does work however when we put it into a standalone python script and serve it via bokeh serve --show script.py.

Bokeh version is 2.0.2, Holoviews version is 1.13.2, Python version is 3.8, hvplot version is 0.5.2, Pandas version is 1.0.3.

This appears to be a bug. Help would be appreciated.

Cheers

Do you have the jupyterlab extension installed? You can get it with:

conda install nodejs
jupyter labextension install @pyviz/jupyterlab_pyviz

If you want that script to work as a deployed app you need to actually serve it somehow, the simplest way to do so nowadays is using panel:

import panel as pn
...
pn.panel(overlay).servable()