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.

Offline mode not displaying inline in Jupyter notebook master?

See original GitHub issue

I hadn’t tested recently, but today, using master of the Jupyter notebook, I can’t get offline plots to display inline, instead I get the external temporary file. Consider this simple test:

from plotly import __version__
from plotly.offline import init_notebook_mode, plot
from plotly.graph_objs import Scatter

init_notebook_mode()

print("plotly version:", __version__)
plot([Scatter(x=[1, 2, 3], y=[3, 1, 6])])

I get for output:

plotly version: 1.9.10
Out[1]: 'file:///Users/fperez/tmp/temp-plot.html'

and the plot correctly opening in a new tab by itself, but no inline notebook output. Here’s a screenshot for reference:

image

In the JS console, I don’t see anything that immediately points to the problem. Here’s a screenshot, b/c copy-pasting text from the JS console makes a mish-mash of the formatting:

image

The above were from current Chrome on OSX, but I replicated the problem on Safari.

Any thoughts on how to proceed much appreciated. Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:41 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
thhancockcommented, Aug 1, 2017

@edoson

Oddly, this only occurs for me in Notebooks with very high memory usage (10+ GB) and LOTs of plots. I have found, for whatever reason, that running the Notebook cell-by-cell also helps (as opposed to “Restart and Run All”).

Here’s the steps I use:

  1. Open Notebook (might have been saved with plots there);

  2. Restart and Clear Output;

  3. Save the Notebook;

  4. Hard Refresh of browser;

  5. Run Notebook cell-by-cell.

11reactions
b11zcommented, May 15, 2017

In newer jupyter versions, the requirejs error might be because of notebook trust. When the notebook considers the .ipynb untrusted, it will not run javascript on initialization. This interferes with the way that plotly gets injected into the jupyter notebook.

If that is the issue, clicking the button in the top right of the notebook to “trust” the ipynb may fix it. Installing & configuring the nbextension might help too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

plot.ly offline mode in jupyter lab not displaying plots
A couple things might be happening. For some reason is your Notebook "Not Trusted?" This will stop the Plotly javascript from rendering ...
Read more >
Jupyter notebook tutorial in Python - Plotly
Jupyter notebook tutorial on how to install, run, and use Jupyter for interactive ... plotly.plotly.iplot() or plotly.offline.iplot() if working offline.
Read more >
Jupyter Notebook 6.5.2 documentation - Read the Docs
A web application: a browser-based tool for interactive authoring of documents which combine explanatory text, mathematics, computations and their rich media ...
Read more >
The Ultimate Markdown Guide (for Jupyter Notebook) - Medium
You simply use HTML for any Markup that is not covered by the Markdown syntax. You don't need to preface it or delimit...
Read more >
Plotly - Plotting Inline with Jupyter Notebook - Tutorialspoint
Keep rest of the script as it is and run the notebook cell by pressing Shift+Enter. Graph will be displayed offline inside the...
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