panel icon indicating copy to clipboard operation
panel copied to clipboard

TypeError when trying to display a plot inside a pane

Open guidocioni opened this issue 1 month ago • 5 comments

ALL software version info

Software Version Info
  Name                                  Version         Build                         Channel    
───────────────────────────────────────────────────────────────────────────────────────────────────
  bokeh                                 3.8.1           pyhd8ed1ab_0                  conda-forge
  datashader                            0.18.1          pyhd8ed1ab_0                  conda-forge
  folium                                0.20.0          pyhd8ed1ab_0                  conda-forge
  geographiclib                         2.0             pyhd8ed1ab_1                  conda-forge
  geoviews                              1.14.0          hd8ed1ab_0                    conda-forge
  geoviews-core                         1.14.0          pyha770c72_0                  conda-forge
  holoviews                             1.22.0          pyhd8ed1ab_1                  conda-forge
  hvplot                                0.12.1          pyhd8ed1ab_0                  conda-forge
  jupyter_bokeh                         4.0.5           pyhd8ed1ab_1                  conda-forge
  jupyter_client                        8.6.3           pyhd8ed1ab_1                  conda-forge
  jupyter_core                          5.8.1           pyh31011fe_0                  conda-forge
  pandas                                2.3.0           py312hcb1e3ce_0               conda-forge
  python                                3.12.11         hc22306f_0_cpython            conda-forge

Running the first example from the doc here https://panel.holoviz.org/reference/panes/HoloViews.html

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

data = {"group": np.random.randint(0, 10, 100), "value": np.random.randn(100)}
df = pd.DataFrame(data)

plot = df.hvplot.box(by="group", y="value", responsive=True, height=300)
plot

shows

Image

However when I try to insert it into a panel (as in the example)

pn.pane.HoloViews(plot, height=300, sizing_mode="stretch_width")

I get lots of TypeError and the figure is not shown

Image

I'm running into a notebook inside VsCode (MacOS). Not sure whether that is relevant or not.

guidocioni avatar Nov 28 '25 10:11 guidocioni

It seems to work for me (though on Linux).

Can you report versions of Panel, pyviz_comms, and IPykernel? And also check you are running the correct environment inside the notebook.

Image

hoxbro avatar Nov 28 '25 11:11 hoxbro

Panel

Hey @hoxbro, here are the versions

panel                                   1.8.3
pyviz_comms                     3.0.4
ipykernel                               6.29.5

I double checked I'm using the right kernel ;)

guidocioni avatar Nov 28 '25 14:11 guidocioni

Panel

Hey @hoxbro, here are the versions

panel                                   1.8.3
pyviz_comms                     3.0.4
ipykernel                               6.29.5

I double checked I'm using the right kernel ;)

Just updated those 2 packages to the new versions but that didn't seem to fix the issue. Needless to say I have tried countless times to restart vscode and reload the notebook

guidocioni avatar Nov 28 '25 14:11 guidocioni

Sorry for the slow response. Could you also report your ipywidgets version? Suspect that is the culprit here.

philippjfr avatar Dec 02 '25 11:12 philippjfr

Actually, that's probably not it either. The tracebacks are confusing and don't provide much context unfortunately. Somehow:

event = deserializer.deserialize(Serialized(content=content, buffers=[]))

deserializes to a figure object, which really should not happen.

philippjfr avatar Dec 02 '25 11:12 philippjfr