Does plotly work with Jupyterlab 4?

I recently updated my Jupyterlab and Jupyterhub to v4 and can no longer get plotly plots to appear. I installed both nodejs and plotly 5.15 via conda into the conda environment launching the notebook.

Below is the following error I am receiving in the notebook:
Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class ‘FigureModel’ from module ‘jupyterlab-plotly’
Error: No version of module jupyterlab-plotly is registered
at f.loadClass (localhost:8000/user/david/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.402424ef4079078b2e0e.js?v=402424ef4079078b2e0e:1:74855)
There are more messages in the stack trace but will stop at this one for now

Any ideas on how to resolve or update on Jupyterlab 4 support?

hi @dpats
:wave: Welcome to the community.

We’ve been having a few challenges with Jupyterlab 4 ourselves.

I’ve talked to my colleague that has been trying to set up jupyterlab4, and has faced many issues.

He would recommend not to use jlab4 yet, it seems to have all sorts of issues that the jupyter folks need to resolve.

Thanks so much for the reply!

I was doing a deep dive in both the plotly and jupyter-widgets repos/issues and coming up empty. It seems like multiple commits have been made to make everything work with JupyterLab 4, so thought I was doing something wrong. Glad to hear I’m not the only one.

Thanks again!

1 Like

Hi @adamschroeder , just checking back on this to see if there are updates RE: plotly supporting Jupyterlab4.

I have a setup which I upgraded from jupyterlab 3.x to jupyterlab4 which somehow is working with plotly. However I haven’t been able to get it working on a different machine - neither through a fresh install of Jupyterlab4 + Plotly nor by installing jupyterlab 3.6.6 and then upgrading to 4.x

hi @gsacavdm
Unfortunately, there is no update on this matter. Our recommendation is to use JupyterLab 3.

@gsacavdm … yeah … I was going to say the same thing. I am currently building my Docker containers with JupyterLab 3.6.6 in order to get things to work. Disappointing, but it works.

@adamschroeder , out of curiosity what’s the challenge with supporting JupyterLab 4?
And do you guys have any rough sense on when you plan to support it?

hi @gsacavdm
We don’t have a good sense of when Dash would work with JupyterLab 4. We were hoping it would work as soon as JupyterLab 4 was released but we found some incompatibilities.

For what it’s worth the PNG rendering of plotly plots does work in Jupyter Lab 4. Install kaleido with pip install -U kaleido and add this to your notebook:

import plotly.io as pio

pio.renderers.default = "png"

With the PNG renderer, plots are not interactive, but if you have to use JLab 4 then it’s better than no plots at all.

1 Like

Actually I am able to use plotly==5.15 with Jupyter Lab 4, so the latest version probably works well too.

@adamschroeder maybe you meant that there is still some work remaining to get dash, not plotly, compatible with Jupyter Lab 4?

I was able to get plotly to render in jupyterlab (4.0.10)

In the jupyterlab environment (that runs the jupyterlab server), I reordered plotly to be at the top.

plotly==5.18.0
# Results in 4.0.10 being installed
jupyterlab>=3 
# Results in 8.1.1 being installed
ipywidgets>=7.6 

In the kernel env I also locked in plotly==5.18.0 and all is rendering. I also did nbformat==5.9.2 which also seemed required to get running

Hello,
I’m pretty new to plotly/dash, but I could make the “simple app example” (coming from https://dash.plotly.com/minimal-app) work with jupyterLab 4.0.10 & plotly 5.18.0. Anyway, If I try to change the way to run the dash application from:

app.run(debug=True)

to:

app.run(jupyter_mode="jupyterlab")

well, nothing happens when I execute the cell of the notebook…although I would expect another “tab” to open in jupyterlab …

Did someone successfully make it work ?

Thanks for your help
Sebastien