Dynamicmap (and holomap) responsiveness when running out of a vscode notebook

Hi, long time no see, but after a while I’m back to having the chance to use your libraries.
Since the last time I used it, I’ve switched to vscode. I’ve noticed something that might be IDE related, which changes the responsivness of Dynamic maps vastly.

I have a “large” holomap of bar plots (3 bars showing frequencies, title changes showing mass), with 6 input parameters. The holomap is comprised of 3072 “slides”. When dealing with it inside the notebook I got a warning about the amount of slides, so I decided to serve it with panel as a way to quickly explore it. The result was that it was really slow, taking ages to update.

Next logical step, I converted it to a Dynamicmap through the use of holoviews.util.Dynamic(). It shows but doesn’t respond when called directly within the vscode notebook, still really unresponsive when served as a panel.

The next step I’ve taken is going from .ipynb to .py files and running them in the terminal. The holomap responsiveness is better but still awful, but now the dynamicmap seems to work fine, being snappy and updating the plots nearly instantly (at the speed I was expecting from the start). Finally, I tried the dynamicmap within jupyter notebook (the default one) and it was responsive.

Is there any know issue with Dynamicmaps when running them from vscode, either within the notebook or when serving them as panels?

PS: this seemed way too specific and small to be an issue within the github, but if it’s useful there let me know.

I can’t help you but I am experiencing the same problem. This very simple code snippet fails from inside an ipynb in VSCode but works fine in JupyterLab on the same conda environment:

import holoviews as hv
#hv.extension('matplotlib')
hv.extension('bokeh')
import pandas as pd

# creating a dataframe with both an int and an obj dtype
df = pd.DataFrame({
    'count':    [ 0,    1,    2 ], 
    'distance': [ 3,    4,    7 ],
    'length':   [ 5,  -20,   35 ]
})

# set up a DynamicMap where the user can select the y_axis column
y_dim = hv.Dimension('y_column', values=df.columns.tolist(), default='distance')
def return_scatter(col_name):
    return hv.Scatter(df, kdims='count', vdims=[col_name])
hv.DynamicMap(return_scatter, kdims=y_dim).opts(framewise=True, axiswise=True)

I’ve tried both the matplotlib and bokeh backends. I’ve given up for the moment and am just developing Panel in JupyterLab and from the terminal.

@GitRay I have made a PR which should make this possible.

1 Like

Thanks! I’ll get around to trying the new code, but for now the workaround you have in the bug works great - adding this to the top of my notebook:

import panel as pn
pn.config.comms = "vscode"
1 Like