Plotly not rendering in jupyterlab (just leaving an empty space)

Plotly is not rendering on my jupyterlab setup… it just leaves an empty space, but no interactive plot, and no static plot either!

The same plotly sample does render on another jupyter lab setup.

The test plot code is this one:

import plotly.graph_objects as go

fig = go.Figure(data=go.Scatter(y=[2, 3, 1]))
fig.show()

The jupyterlab kernel has these relevant installs:

$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.26.0
ipykernel        : 6.29.5
ipywidgets       : 8.1.3
jupyter_client   : 8.6.2
jupyter_core     : 5.7.2
jupyter_server   : 2.14.1
jupyterlab       : 4.2.3
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.14.3

$ pip freeze | egrep "jup|nbf|kale|plotly"
jupyter-dash==0.4.2
jupyter-events==0.10.0
jupyter-lsp==2.2.5
jupyter_client==8.6.2
jupyter_core==5.7.2
jupyter_server==2.14.1
jupyter_server_terminals==0.5.3
jupyterlab==4.2.3
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.2
jupyterlab_widgets==3.0.11
kaleido==0.2.1
nbformat==5.10.4
plotly==5.22.0

Is there something else I need to do to make plotly work in jupyterlab?

@russ yes, you need to downgrade to jupyter 3.9

Plotly and Jupiter 4 are not really compatible.

Thanks, @AIMPED . I was wondering if that might be the case. :frowning:

That is unfortunate, since JupyterLab v4 was release almost a year ago. I suppose it is reasonable to expect that the Plotly team would focus on Dash vs Jupyter, but… :cry: … going to be interesting to try and downgrade my jupyterhub/jupyterlab setup. I do really want fast/interactive plotly plots, though!

Been reading this “Does plotly work with Jupyterlab 4” post…

Seems like some have had some luck on that thread? It seems to require strictly pinned versions of a few things, which is not ideal. :frowning: Will probably just backtrack to jupyterlab < 4.

FIXED! I now have interactive plotly plots working with jupyterlab 4.2! No need to downgrade to v3.x.

I went looking in github to see if there were known issues and/or anything I could contribute back to fix this problem… and I found this awesome post:

The magic trick required is to install plotly in the python environment that is running jupyterlab (and jupyterhub in my case). Works great now!! :smiley:

1 Like