question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plotly plots not working in Jupyterlab

See original GitHub issue

When I run this example:

import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
fig.show()

in a Jupyter notebook under jupyter lab I get no output. The output cell expands as if it is going to show output, but it is just blank. I see this error in the browser console:

VM458:2 Uncaught ReferenceError: require is not defined
    at <anonymous>:2:17
    at t.attachWidget (vendors~main.479571ea0f6c7741ac01.js:2)
    at t.insertWidget (vendors~main.479571ea0f6c7741ac01.js:2)
    at C._insertOutput (vendors~main.479571ea0f6c7741ac01.js:2)
    at C.onModelChanged (vendors~main.479571ea0f6c7741ac01.js:2)
    at m (vendors~main.479571ea0f6c7741ac01.js:2)
    at Object.c [as emit] (vendors~main.479571ea0f6c7741ac01.js:2)
    at e.emit (vendors~main.479571ea0f6c7741ac01.js:2)
    at f._onListChanged (vendors~main.479571ea0f6c7741ac01.js:2)
    at m (vendors~main.479571ea0f6c7741ac01.js:2)

Googling I see others that had that problem had bad installs of extensions, I don’t think I have that:

My jupyterlab + extension versions are:

xbk@30c1f8a93eeb:~/xbk_trade_advisory/code/chquery$ jupyter --version
jupyter core     : 4.6.2
jupyter-notebook : 6.0.3
qtconsole        : 4.7.1
ipython          : 7.12.0
ipykernel        : 5.1.4
jupyter client   : 5.3.4
jupyter lab      : 2.0.1
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.4
traitlets        : 4.3.3
xbk@30c1f8a93eeb:~/xbk_trade_advisory/code/chquery$ jupyter labextension list
JupyterLab v2.0.1
Known labextensions:
   app dir: /usr/local/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        jupyterlab-plotly v4.9.0  enabled  OK
        plotlywidget v4.9.0  enabled  OK

Thanks for any help with this.

Matt

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:17
  • Comments:26 (4 by maintainers)

github_iconTop GitHub Comments

36reactions
derekhecommented, Apr 25, 2021

I managed to make it work in jupyter lab using:

import plotly.io as pio
pio.renderers.default='iframe'
6reactions
JanHomanncommented, Sep 8, 2020

I figured out that setting pio.renderers.default to iframe, iframe_connected, or browser works. But not jupyterlab or notebook. When set to notebook an empty space shows up where the plot is supposed to be, when set to jupyterlab, it finishes the computation and nothing happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plots not showing up in Jupyter Lab (Plotly 3.0) - Plotly Python
When I use init_notebook_mode, it shows a blank space for plots but the plot is still not shown. from plotly.offline import plot, ...
Read more >
Unable to display plotly figures output - JupyterLab
I am working on Jupyterlab on a docker container, on an EC2 machine on AWS, versions: IPython : 7.30.1 ipykernel : 6.6.0 ipywidgets...
Read more >
Plotly Issue: (Graphs not showing even after publishing)
Plotly Issue: (Graphs not showing even after publishing) ... I guess a lot of you guys have had this problem nevertheless, I wanted...
Read more >
Getting Plotly working in Jupyter Lab and fastpages
Plotly allows one to create interactive charts and maps with APIs in Python, R, and JavaScript. It's intuitive, highly customisable and from ...
Read more >
Setting up Plotly Dash in JupyterLab & Jupyter Notebook
In this tutorial you'll learn to set up Jupyter Lab and Jupyter Notebook to run your Plotly Dash Apps, using PC or Mac....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found