Widget troubles with the Panel/Voila integration

I’d like to serve panel objects, including holoviews graphs, with Voila, following instructions in the deployment guide. However, HoloMap/DynamicMap widgets seem to lose their interactivity when I do so.

To front load the MRE, this works fine in JupyterLab (I get an interactive dmap with widgets):

import panel as pn
import numpy as np
import pandas as pd
import holoviews as hv
import hvplot.pandas

df = pd.DataFrame(np.random.rand(300).reshape((100,3)), columns=['a','b','c'])
df['c'] = df['c'] > 0.5

pn.ipywidget(df.hvplot.line(groupby='c'))

The JupyterLab Voila preview as well as the Voila command also display this fine, but the widgets no longer update the plot. I’m not seeing any errors Python-side that would indicate problems. Same deal if I try pn.extension(comms='ipywidgets')

My env was pretty clean - a fresh Python 3.7 conda env on Ubuntu in which I installed jupyterlab, hvplot, voila, and jupyter_bokeh from conda-forge. According to jupyter labextension list this gave me:

JupyterLab v3.0.16
/home/jokasinski/miniconda3/envs/voila/share/jupyter/labextensions
        @bokeh/jupyter_bokeh v3.0.0 enabled OK (python, jupyter_bokeh)
        @voila-dashboards/jupyterlab-preview v2.0.2 enabled OK (python, voila)
        @pyviz/jupyterlab_pyviz v2.0.1 enabled OK (python, pyviz_comms)
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)

Which should be okay, if I understand the docs.

I tried installing jupyter_bokeh from bokeh instead of conda-forge, but then that example stopped working in the notebook. I tried to install everything (including nodejs) from bokeh instead, and then run the labextension commands in the panel documentation, but it fails to build jupyter_bokeh - looks like it can’t find a node_modules directory.

There are other permutations I could try, but unless I misunderstand I think this contradicts the Panel documentation and is a bug. However, there are a lot of moving parts I haven’t chased down yet, so the real problem could be elsewhere.

Am I not installing these packages properly/have bad version combinations? Is this functionality intended to be supported? Let me know if there’s any other info I can provide - any help would be greatly appreciated. Thanks!

It’s a regression in Bokeh unfortunately [BUG] Layout regression in panel introduced by PR #11123 Β· Issue #11188 Β· bokeh/bokeh Β· GitHub

Update: answer for another post.

Sorry I don’t quite understand - the widget & all the graphs are present, it’s just that sliding the widgets no longer updates the graph. How does the layout regression cause this?

Sorry.My answer was for another post.

I cannot get Voila working either. See Enable serving notebook as interactive docs with static code cells Β· Issue #2241 Β· holoviz/panel Β· GitHub

@philippjfr . Should @nitrocalcite create a specific β€œVoila not working” bug report?

Happy to do so, just let me know which library. To me it looks a panel bug because it contradicts panel docs, but I would figure that the underlying issue is in jupyter_bokeh. However, having not yet reproduced without holoviews/hvplot, I can’t really exclude them either.

1 Like

I had this problem too. Previously, I mainly used Voila to serve the dashboard with the combination of Panel and Ipywidgets. However, after I updated both (Panel and Voila) packages recently, it stopped to work. In my case, last combinations that worked was Panel==0.11.0 and voila==0.2.7.

1 Like

@philippjfr are you aware of this issue?

Looking into it now.

2 Likes

Okay, figured it out, for some reason the dist bundle wasn’t included when uploading the jupyter_bokeh 3.0.0 bundle to NPM. I’ll try to release 3.0.1 as soon as I get a chance.

1 Like

Fix is here: Bundle dist directory by philippjfr Β· Pull Request #132 Β· bokeh/jupyter_bokeh Β· GitHub

1 Like

I’ve released jupyter_bokeh 3.0.2 to NPM and PyPI now. Will follow up with conda-forge once the bot updates the recipe.

2 Likes

@philippjfr . This made Panel work in VS Code again. But it does not get Voila working

Notes from test


$ "C:\Python38\python.exe" -m venv .venv
$ source .venv/Scripts/activate
$ pip install -r requirements.txt
Collecting panel==0.11.3
  Using cached panel-0.11.3-py2.py3-none-any.whl (9.0 MB)
Collecting jupyter_bokeh==3.0.2
  Downloading jupyter_bokeh-3.0.2-py3-none-any.whl (1.4 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.4 MB 2.2 MB/s
Collecting jupyterlab
  Using cached jupyterlab-3.0.16-py3-none-any.whl (8.2 MB)
Collecting voila
  Downloading voila-0.2.10-py3-none-any.whl (1.6 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.6 MB 6.4 MB/s

test_voila.ipynb (43.2 KB)

It’s not working if I run it from the command line either

voila test_voila.ipynb

Yeah thanks a lot for looking into this promptly, but like Marc I can confirm that the widgets are still not interactive with voila under jupyter_bokeh 3.0.2. Was just in the process of triple checking I’ve got my env set up right.

1 Like

I added a bug report here Voila cannot serve Panel Apps Β· Issue #2351 Β· holoviz/panel (github.com)

Thanks, will have to dig into this further.

1 Like