Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panel 1.4.3 regression: KeyError: 'content' in jupyterlab #6865

Closed
1 task
avivazran opened this issue May 26, 2024 · 11 comments
Closed
1 task

panel 1.4.3 regression: KeyError: 'content' in jupyterlab #6865

avivazran opened this issue May 26, 2024 · 11 comments
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@avivazran
Copy link

ALL software version info

OS: win10
Jupyter Lab Version 4.1.5
bokeh version: 3.4.1
Python version: 3.9.13

Description of expected behavior and the observed behavior

Complete, minimal, self-contained example code that reproduces the issue

multi_select = pn.widgets.MultiSelect(name='MultiSelect', value=['Apple', 'Pear'],
    options=['Apple', 'Banana', 'Pear', 'Strawberry'], size=8)

multi_select
Traceback (most recent call last):
  File "C:\PythonCodes\SEVToolBox\sev_tools_env\sevtoolboxenv\lib\site-packages\pyviz_comms\__init__.py", line 340, in _handle_msg
    self._on_msg(msg)
  File "C:\PythonCodes\SEVToolBox\sev_tools_env\sevtoolboxenv\lib\site-packages\panel\viewable.py", line 469, in _on_msg
    patch = manager.assemble(msg)
  File "C:\PythonCodes\SEVToolBox\sev_tools_env\sevtoolboxenv\lib\site-packages\panel\models\comm_manager.py", line 29, in assemble
    msg_obj = cls(header, msg['metadata'], msg['content'])
KeyError: 'content'

Stack traceback and/or browser JavaScript console output

image

Screenshots or screencasts of the bug in action

image

  • I may be interested in making a pull request to address this
@hoxbro
Copy link
Member

hoxbro commented May 27, 2024

Can't seem to recreate it. Can you check if you have the latest version of pyviz_comms?

@xdev-x
Copy link

xdev-x commented May 27, 2024

Same issue here, with the latest version of pyviz_comms. How can we help you to reproduce ?

@avivazran
Copy link
Author

Looks like issue affects widgets based on jupyter widgets or ipywidgets. Issue is gone after pulling previous environment from git. My venv code sits on its own repo.

@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label May 28, 2024
@xdev-x
Copy link

xdev-x commented May 28, 2024

@avivazran what are the package version you are using ?

On my side, I have the issue in a venv with

(jupyterlab + holoviews[recommended])

Package                   Version
------------------------- --------------
anyio                     4.4.0
appnope                   0.1.4
argon2-cffi               23.1.0
argon2-cffi-bindings      21.2.0
arrow                     1.3.0
asttokens                 2.4.1
async-lru                 2.0.4
attrs                     23.2.0
Babel                     2.15.0
beautifulsoup4            4.12.3
bleach                    6.1.0
bokeh                     3.4.1
certifi                   2024.2.2
cffi                      1.16.0
charset-normalizer        3.3.2
colorcet                  3.1.0
comm                      0.2.2
contourpy                 1.2.1
cycler                    0.12.1
debugpy                   1.8.1
decorator                 5.1.1
defusedxml                0.7.1
executing                 2.0.1
fastjsonschema            2.19.1
fonttools                 4.52.4
fqdn                      1.5.1
h11                       0.14.0
holoviews                 1.18.3
httpcore                  1.0.5
httpx                     0.27.0
idna                      3.7
ipykernel                 6.29.4
ipython                   8.24.0
isoduration               20.11.0
jedi                      0.19.1
Jinja2                    3.1.4
json5                     0.9.25
jsonpointer               2.4
jsonschema                4.22.0
jsonschema-specifications 2023.12.1
jupyter_client            8.6.2
jupyter_core              5.7.2
jupyter-events            0.10.0
jupyter-lsp               2.2.5
jupyter_server            2.14.0
jupyter_server_terminals  0.5.3
jupyterlab                4.2.1
jupyterlab_pygments       0.3.0
jupyterlab_server         2.27.2
kiwisolver                1.4.5
linkify-it-py             2.0.3
Markdown                  3.6
markdown-it-py            3.0.0
MarkupSafe                2.1.5
matplotlib                3.9.0
matplotlib-inline         0.1.7
mdit-py-plugins           0.4.1
mdurl                     0.1.2
mistune                   3.0.2
nbclient                  0.10.0
nbconvert                 7.16.4
nbformat                  5.10.4
nest-asyncio              1.6.0
notebook                  7.2.0
notebook_shim             0.2.4
numpy                     1.26.4
overrides                 7.7.0
packaging                 24.0
pandas                    2.2.2
pandocfilters             1.5.1
panel                     1.4.3
param                     2.1.0
parso                     0.8.4
pexpect                   4.9.0
pillow                    10.3.0
pip                       24.0
platformdirs              4.2.2
prometheus_client         0.20.0
prompt_toolkit            3.0.45
psutil                    5.9.8
ptyprocess                0.7.0
pure-eval                 0.2.2
pycparser                 2.22
Pygments                  2.18.0
pyparsing                 3.1.2
python-dateutil           2.9.0.post0
python-json-logger        2.0.7
pytz                      2024.1
pyviz_comms               3.0.2
PyYAML                    6.0.1
pyzmq                     26.0.3
referencing               0.35.1
requests                  2.32.2
rfc3339-validator         0.1.4
rfc3986-validator         0.1.1
rpds-py                   0.18.1
Send2Trash                1.8.3
six                       1.16.0
sniffio                   1.3.1
soupsieve                 2.5
stack-data                0.6.3
terminado                 0.18.1
tinycss2                  1.3.0
tornado                   6.4
tqdm                      4.66.4
traitlets                 5.14.3
types-python-dateutil     2.9.0.20240316
typing_extensions         4.12.0
tzdata                    2024.1
uc-micro-py               1.0.3
uri-template              1.3.0
urllib3                   2.2.1
wcwidth                   0.2.13
webcolors                 1.13
webencodings              0.5.1
websocket-client          1.8.0
xyzservices               2024.4.0

@ahuang11
Copy link
Contributor

ahuang11 commented May 28, 2024

I think downgrading to 1.4.2 works pip install panel!=1.4.3. Just be sure to restart kernel / close browser / clear browser cache after.

If I had to guess, I think it might be related to #6818

@pmav99
Copy link
Contributor

pmav99 commented May 28, 2024

I think downgrading to 1.4.2 works pip install panel!=1.4.3. Just be sure to restart kernel / close browser / clear browser cache after.

@ahuang I think that the trick is to actually "clean" the notebook. (e.g. nbstripout or "Restart and clean all cell outputs"). If I understand this correctly, panel.extension() injects some JS code in the *.ipynb file which loads the JS/CSS files from the CDN. If you don't clean the notebook, then as soon as the browser page loads, this JS code seems to gets executed (even before executing any cells) and the result is that you get the behavior of the "before-the-update" panel version.

@ahuang11 ahuang11 changed the title some widgets like CrossSelector and MultiSelect broken in 1.4.3 panel 1.4.3 regression: KeyError: 'content' in jupyterlab May 28, 2024
@pmav99
Copy link
Contributor

pmav99 commented May 29, 2024

Actually the trick is to:

  1. Execute "Restart kernel and clear the outputs of All Cells"
  2. Save the notebook: Ctrl + s
  3. "Hard" reload the browser tab: usually Ctrl + F5 or Shift + Ctrl + F5 but it depends on the browser.

pmav99 added a commit to pmav99/Thalassa that referenced this issue May 29, 2024
@vsriram11
Copy link

I'm facing the same issue, and the fix suggested above to restart/hard reload does not work for me. The regression is actually from 1.3.8 to 1.4.0, fixing panel version to 1.3.8 resolves the issue for me.

@pmav99
Copy link
Contributor

pmav99 commented May 29, 2024

Nope. 1.4.1 and 1.4.2 work fine. But you must clean the notebook and save it before you reload the tab and restart the kernel. That being said if you don't need some feature from panel 1.4 (or bokeh 3.4) then you are fine with downgrading to 1.3, too

@MarcSkovMadsen
Copy link
Collaborator

I also experienced this issue in our Jupyterlab after upgrading its Python environment.

@philippjfr
Copy link
Member

Yes, this is an urgent regression. Will release 1.4.4 tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

8 participants