Panel example not working in VSCode

I am trying to run this example in notebook within VSCode.It renders properly but there is no update on selecting a row in the table.

How can I debug this ? What could be the issue? I have started trying out Panel today.

1 Like

Have you installed jupyter_bokeh? See Develop in other notebook environments — Panel v1.1.1

Yes, I have jupyter_bokeh version 3.0.7 installed.
Since I am using notebook, I have pn.extension('tabulator') in the code.

Following is the code I use in the cell, with changes in the pn.extension() call from the original example.

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

pn.extension('tabulator')

lookup = {0: "A", 1: "B", 2: "C"}

pars = pd.DataFrame(
    {"name": ["A", "B", "C"], "period": [1, 0.5, 0.3], "amplitude": [0.3, 0.4, 0.1]}
)
xx = np.linspace(0, 1, 100)
arr = pars["amplitude"].to_numpy() * np.sin(
    np.outer(2 * np.pi * xx, 1.0 / pars["period"].to_numpy())
)
curves = pd.DataFrame(dict([(pars["name"][i], arr[:, i]) for i in range(0, 3)]), index=xx)


def compute_plot(selection):
    if not selection:
        selection_df = curves
    else:
        selection = [lookup[i] for i in selection]
        selection_df = curves[selection]
    return selection_df.hvplot(grid=True)


tabedit = pn.widgets.Tabulator(
    value=pars, show_index=False, selectable=True, disabled=True, theme="site", height=140
)
plot = pn.bind(compute_plot, selection=tabedit.param.selection)

pn.Column(tabedit, plot)

I am trying to see what is causing it.
I am running VSCode in Remote container and the Jupyter Notebook through VSCode extension does not update on Widget events.
But if I use Jupyterlab from that container, forward the ports and then use the notebook from within Jupyterlab to develop the Panel app, the widget events update the plot. Again then the servable() way of rendering the Panel app does not work.


Is this something because of the remote dev container environment in which I am developing?

1 Like

Hi @aeroaks

Would it be possible for you to provide a minimum, reproducible example and describe the steps to run it?

  • Dockerfile
  • Commands to start docker container
  • VS Code configuration and extensions if relevant
  • Steps in VS Code

If its easy to replicate your issue its most often easy to find the cause. Without it, it is normally very, very difficult.

Thanks.