nebari-dev / nebari

🪴 Nebari - your open source data science platform
https://nebari.dev
BSD 3-Clause "New" or "Revised" License
281 stars 93 forks source link

[BUG] - Panel preview refresh does not work #2722

Open pavithraes opened 2 months ago

pavithraes commented 2 months ago

Describe the bug

The Panel preview in JupyterLab does not display plots and widgets.

It was recently worked on in #2580. The template elements seem to render, but the widgets and plots in the main and sidebar are not displayed. In a layout without a template, the preview is blank.

Screenshot 2024-09-17 at 12 43 45 PM

Expected behavior

All elements of the Panel dashboard should be rendered in the preview.

OS and architecture in which you are running Nebari

GCP (demo.nebari.dev)

How to Reproduce the problem?

Use the env & code in https://jhub-apps.nebari.dev/docs/create-apps/panel-app, with the specific versions mentioned below

Command output

No response

Versions and dependencies used.

Panel - 1.5.0 Bokeh - 3.5.2

Compute environment

GCP

Integrations

No response

Anything else?

No response

pavithraes commented 2 months ago

@krassowski - Do you have thoughts on what might be happening here?

krassowski commented 2 months ago

@pavithraes, yes:

Since there was not even a pre-release of the new nebari yet, this would not work unless you are running manually built dockere images of the main branch of nebari-docker-images repo.

krassowski commented 2 months ago

So I think this is a duplicate of https://github.com/nebari-dev/nebari/issues/2580. The fix requires the dependencies on both sides (client conda environment AND the base docker image) to be updated; if you updated the dependencies in your environment only you would get a partial fix as described in your issue, so I think this is likely what happened, but let me know if you were running of the latest docker image from main :)

pavithraes commented 2 months ago

I thought @marcelovilla updated the demo.nebari.dev instance to use docker images from the main, i.e., including your PR. I'll let him chime in and then close if this issue is a duplicate. :)

krassowski commented 2 months ago

If I can get an account on that instance I can investigate :)

krassowski commented 2 months ago

The default environment has an old version of bokeh (but the correct version of pyviz-comms):

image

We need bokeh >=3.5.2 as specified in https://github.com/nebari-dev/nebari-docker-images/pull/178. Also, the panel version is older in the image than what you have in your environment (but I think that should not matter).

pavithraes commented 2 months ago

Thanks for investigating!

krassowski commented 2 months ago

@marcelovilla double checked that the image is right. It appears that this is an issue with the image.

In logs I see that it gets installed correctly from conda:

#27 41.77   + bokeh                                   3.5.2  pyhd8ed1ab_0         conda-forge/noarch         5MB

but then overwritten with pip install of jhub-apps

#27 160.7 Collecting bokeh (from jhub-apps==2024.8.1->-r /opt/jupyterlab/condaenv.xipmi690.requirements.txt (line 4))
#27 160.7   Downloading bokeh-3.4.3-py3-none-any.whl.metadata (12 kB)

which directly related to:

Since there is no pin for bokeh in jhub-apps pyproject.toml file (but it is listed as a dependency) we suspect it might be an indirect dependency causing pip solver to use an older version.

As discussed also with @aktech and @viniciusdc adding a second pin in the pip section might solve it (or break the install if pip solver gets unhappy).

krassowski commented 2 months ago

It looks like the fix is to simply rebuild the image. The only pin that I see is in panel which requires:

Because panel gets installed in pip group as a dependency of jhub-aps and because panel 1.5.0 was only released yesterday, the bokeh version was overwritten in the old builds. If someone is going to cut an RC version of images it would likely "fix itself".

That said, we need to solve https://github.com/nebari-dev/nebari-docker-images/issues/173 which I think needs to be done by publishing jhub-apps to conda-forge (and adding pip check otherwise). Thoughts?

marcelovilla commented 2 months ago

Thanks for looking into this @krassowski! I cut an RC of the docker images and updated the demo deployment with them. I'm on board with publishing jhub-apps to conda-forge and adding pip check to our GHA workflows.

@pavithraes can you let me know if it works now? Looking through the logs, it seems the correct bokeh version gets installed by conda and then pip does not try to install it as the requirement is satisfied.

krassowski commented 2 months ago

For what's it worth, it looks good to me now:

image

I used the reproducer from @kcpevey's post here: https://discourse.holoviz.org/t/widget-updates-appear-blocked-by-python-until-process-in-complete-in-deployed-app/7103

krassowski commented 2 months ago

Refresh button does not work though. Closing and reopening the preview works.

marcelovilla commented 1 month ago

@pavithraes can we close this issue now?

pavithraes commented 1 month ago

As discussed, I think we can keep this open and use it to track the refresh-not-working part