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.

plots in Jupyter notebooks exports to HTML do not show without internet connection

See original GitHub issue

A Jupyter notebook exported to HTML produces the error message

Uncaught ReferenceError: require is not defined

in Chrome when there is no internet connection. The plot does not show, there is only blank space where it should be.

reproducable example:

import plotly.express as px
iris = px.data.iris()
px.scatter(iris, x="sepal_width", y="sepal_length", color="petal_length")

and after:

jupyter nbconvert --to html ...

Exporting the plot directly with fig.write(...) works fine, both online and offline.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
emmanuellecommented, Dec 6, 2019

Please see my answer in the forum https://community.plot.ly/t/html-export-from-jupyter-notebook-for-offline-viewing/32104/13 I had missed an important information about the lack of internet connection, Does

import plotly.io as pio
pio.renderers.default = "notebook"

work for you?

2reactions
nicolaskruchtencommented, May 20, 2021

This is the clearest explanation I’ve been able to write 😃 https://github.com/plotly/plotly.py/issues/931#issuecomment-819502866

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exporting Jupyter notebook with plotly to html not displaying ...
If I turn on my internet connection the plots are rendered, just fine. Here is a sample code: import pandas as pd import...
Read more >
HTML export from Jupyter Notebook for offline viewing
When I export HTML from Jupyter Notebook, the plot.ly figures only show if there is an internet connection. Otherwise, I get the following ......
Read more >
Bokeh plot not rendering in Jupyter Notebook saved to html ...
Hi All,. I'm trying to get Bokeh plots to render in Jupyter Notebooks saved to html output which then need to be viewed...
Read more >
3 ways to export Jupyter Notebook to HTML - MLJAR
The most strightforward way to get HTML file from Jupyter Notebook is to use Download as function inside the Jupyter application. Please click ......
Read more >
Jupyter Notebook as a Product - Towards Data Science
The bottom line exports the notebook to HTML. To html specifies the format, and no input, no prompt hide the code. The end...
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