🚀 Gen 5 of the leading AI app deployment platform launches October 6. Click for the livestream.

Javascript error when embedding Plotly HTML output in jupyter notebook

I’m trying to embed the HTML from plotly into a jupyter notebook. For example:

  <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
  <div id="7979e646-13e6-4f44-8d32-d8effc3816df" style="height: 525; width: 100%;" class="plotly-graph-div"></div><script type="text/javascript">window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("7979e646-13e6-4f44-8d32-d8effc3816df", [{"x": [1, 2, 3], "y": [3, 1, 6]}], {}, {"showLink": false, "linkText": ""})</script>

I can put this in an HTML file and load it fine in my browser and it works.

If I make an html cell (%%html) in a jupyter notebook, or if I use display(HTML()) from the IPython module, I get this error:

Javascript error adding output!
ReferenceError: Plotly is not defined
See your browser Javascript console for more details.

Why is this?

Hey, did you ever figure this problem out? I’m having the same exact thing happen to my app…


I am getting the same error. Does anyone have a solution?