Thanks to visit codestin.com
Credit goes to github.com

Skip to content

notebook backend figures close spontaneously #6075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 tasks done
fperez opened this issue Feb 29, 2016 · 18 comments
Closed
5 tasks done

notebook backend figures close spontaneously #6075

fperez opened this issue Feb 29, 2016 · 18 comments

Comments

@fperez
Copy link
Member

fperez commented Feb 29, 2016

  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec  7 2015, 11:24:55) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Vendor:  Continuum Analytics, Inc.
Package: mkl
Message: trial mode expires in 29 days
>>> matplotlib.__version__
'1.5.1'
  • How did you install Matplotlib and Python (pip, anaconda, from source ...)

Conda.

  • If possible please supply a Short, Self Contained, Correct, Example
    that demonstrates the issue i.e a small piece of code which reproduces the issue
    and can be run with out any other (or as few as possible) external dependencies.
%pylab notebook
plot([1,2,3])
  • If this is an image generation bug attach a screenshot demonstrating the issue.

No

  • If this is a regression (Used to work in an earlier version of Matplotlib), please
    note where it used to work.

Not sure, hadn't noticed.

Issue specifics

If I create any figure with the notebook backend, and I switch away from the open notebook to some other work, invariably after returning to the open notebook a few minutes later I find my interactive figure closed (replaced by the static png render).

Is this intended behavior, is there a timeout somewhere that can be used controlled, or is it a bug?

Thanks!

@jenshnielsen
Copy link
Member

@fperez That definitely sound like a bug but not something I have not seen that happening. I have seen the interaction break with figures after long time in the sense that the browser still thinks they are interactive but the interaction does not work. However that only happens after suspending the computer and so on and does not convert the figure to a static image.

Could this be browser related? I have mainly used the notebook backend in Chrome. (It should of cause run in all the same browsers as Jupyter does) Are there any messages in the browser console? or in the Jupyter log. It is normal to see warnings such as

[IPKernelApp] WARNING | No such comm: 41e5fc06a23844c69f259757714a98f9

due to a bug in our closing of the comm object in the notebook backend when closing a figure.

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Feb 29, 2016
@pelson
Copy link
Member

pelson commented Feb 29, 2016

@fperez - is your browser being refreshed? Currently the interactive figure is baked into a static png once the page is reloaded, and could conceivably be the issue...

@mdboom
Copy link
Member

mdboom commented Feb 29, 2016

@pelson's theory sounds plausible to me as well... I've never seen this happen personally...

@fperez
Copy link
Member Author

fperez commented Mar 1, 2016

Nope, no refresh at all: this was on Chrome, and it happens in a few minutes, just by going to another window/desktop and coming back shortly thereafter. No errors logged at the console, nothing...

@fperez
Copy link
Member Author

fperez commented Mar 2, 2016

Did some more testing, had it happen in under 10 seconds while I was typing in the notebook itself. No tab switching, nothing... I added calls to print(datetime.now().time()) at plot creation to get a time from when it happened, and it took ~10s to occur this time. I've had it take longer, though, so it's not deterministic. My chrome version is 48.0.2564.116 (64-bit).

I just tried with Firefox, and I'm not seeing it happen at all... I'll leave it running for a while to see if it eventually happens, but after a few minutes, nothing (when Chrome does it pretty quickly).

BTW, several times it occurred, I saw nothing on the JS console in Chrome. But on the last occurrence, I did get this (screenshot b/c copy/pasting messes formatting horribly):

image

Hope it helps...

@fperez
Copy link
Member Author

fperez commented Mar 2, 2016

@jdfreder, @minrk, any thoughts on this one? The players seem to be Chrome, mpl and our comms machinery, perhaps you've seen it or have ideas?

@fperez
Copy link
Member Author

fperez commented Mar 2, 2016

OK, I've now reproduced it also on Firefox (still on OSX, same versions of the rest).

This time it took ~ 1 minute to happen, and I was watching the browser when it happened. It simply closed the figure and left the static png in place without any input from me, just as if I'd clicked the "close" button. Nothing on the JS console.

@pelson
Copy link
Member

pelson commented Mar 2, 2016

What versions of Jupyter packages are you running? Are you able to reproduce on older versions (assuming dev)?

@fperez
Copy link
Member Author

fperez commented Mar 2, 2016

I'm running this off the master of the notebook. I'll set up an isolated conda env later with official/older versions, but not today, I'm afraid (swamped with deadlines).

Thanks a lot for looking into this! If it's a bug on our side, we'll track it down :)

@mdboom
Copy link
Member

mdboom commented Mar 2, 2016

@blink1073: Do you have any thoughts?

@blink1073
Copy link
Member

I'm also using master of the notebook, matplotlib master and then matplotlib 1.51, Chrome on OSX 10.11, and I could not reproduce. I'm not sure what could be causing it, either...

@jaidhyani
Copy link

Reproduced on matplotlib 1.5.1, Chrome, Ubuntu 15.10

@fperez
Copy link
Member Author

fperez commented Mar 30, 2016

ping @jdfreder...

@icoxfog417
Copy link

This reproduce on my environment (Chrome, Windows10) too.

Python 3.5.1 |Continuum Analytics, Inc.| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'1.5.1'

@michaelaye
Copy link

michaelaye commented May 11, 2016

I have this problem too and can force it to happen simply by saving the notebook, meaning, at the moment I click on Save, the nbagg plot backend closes (without any error in the terminal of the notebook server).

I have the same exact behaviour on all of my OSX 10.10.5 browsers:

  • Chrome 50.0.2661.94 (64-bit)
  • Safari Version 9.1 (10601.5.17.4)
  • Firefox 46.01

I started noticing it a while ago, right now I went back up to MPL 1.4.3 (the earliest conda offers), and it shows itself the same way throughout between MPL 1.5.1 and 1.4.3.
Maybe this isn't an MPL issue at all and it's a notebook issue? Will go through different notebook versions now...

@michaelaye
Copy link

Looks like a notebook issue: I downgraded to notebook 4.1 and there I can not force the notebook backend plot to close simply by saving the notebook. My above tests were performed with notebook 4.2 (both versions as delivered by conda).
For reference, this is the simple test code I run, saving the notebook would close the plot for me:

import matplotlib as mpl
mpl.__version__

%matplotlib nbagg

import matplotlib.pyplot as plt
import numpy as np

plt.plot(np.sin(np.linspace(0,2*np.pi, 100)))

@tacaswell
Copy link
Member

This will also (hopefully) be fixed by the nbagg overhaul which is currently on master.

@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0.2 (next bug fix release) May 3, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@fperez
Copy link
Member Author

fperez commented Aug 17, 2022

Closing as this is pretty stale and I haven't seen this problem in ages. Thx all!

@fperez fperez closed this as completed Aug 17, 2022
@story645 story645 removed this from the future releases milestone Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests