Hi,
this is my first time posting on GitHub so excuse me if I am doing it wrong. I could not find this issue being reported or addressed by anyone.
I am regularly experiencing an annoying trouble with Jupyter notebooks. Namely after some time, notebooks fail to display the inline matplotlib plots on startup but instead simply display something like
First, why is this happening? I might be doing something wrong without knowing it.
Second, is there an easier way to recreate a "working" notebook without copy pasting the cells. Note that using the "Make a copy..." function does not help.
I am on Windows 10, python 2.7, IPython 4.0.0
Namely after some time, notebooks fail to display the inline matplotlib plots on startup but instead simply display something like for plots of the notebook.
I'm not sure what you're seeing - are the plots there at first and then they disappear? Or do they never show up, but you expect them to? How long does this take?
What browser are you using? Can you try a different one? Do you have any extensions, either to your browser or to the notebook itself?
The plots never appear while they should (they do for the first n-th times I open the notebook). Then, something happens (I don't know what) and I only see something like
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
I am using Firefox 32-bit (just realized that it is the 32-bit version while my machine is 64-bit).
I experienced this problem for quite some time. In the beginning I was using no extensions. Now I use several extensions : execute time, (some) LaTeX environment, scratchpad, autosavetime, codefolding, initialization cells, collapsible headings and table of contents (2).
I will try on Chrome to see if anything changes.
If you can make it happen with an example notebook you don't mind sharing, please upload the notebook once it's happened, so we can see if the problem is that the data is disappearing, or that it's just not showing up for you.
Here is a notebook where I have this problem. It is small and light compared to my other notebooks so it's good for checking I guess.
Ah, you're using SVG figures. I'd guess that when the figures disappear, it's because the notebook has become untrusted. Are you running it on different computers, synchronised by something like Dropbox or Github?
Output formats like HTML and SVG are able to send code to the kernel to execute, so we have to be careful about displaying them, because it's a security risk. If a notebook is recognised as one that you have run all of and saved on this computer before, it is _trusted_, and those outputs are displayed. If any of the outputs weren't generated and saved on this computer, it's untrusted, and you can't see potentially dangerous outputs.
Possible workarounds:
Yes indeed I do synchronize them on several computers. Marking them as trusted works indeed and the figures reappear!
I guess it was a trivial problem and I feel sorry for wasting your time with this. Thank you very much for your help!
No worries, this stuff can be confusing. Closing as it appears to be working as designed.
Most helpful comment
Ah, you're using SVG figures. I'd guess that when the figures disappear, it's because the notebook has become untrusted. Are you running it on different computers, synchronised by something like Dropbox or Github?
Output formats like HTML and SVG are able to send code to the kernel to execute, so we have to be careful about displaying them, because it's a security risk. If a notebook is recognised as one that you have run all of and saved on this computer before, it is _trusted_, and those outputs are displayed. If any of the outputs weren't generated and saved on this computer, it's untrusted, and you can't see potentially dangerous outputs.
Possible workarounds: