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
Cannot manually close matplotlib plot window in Mac OS X Yosemite #5624
Comments
@Auerilas I have not been able to replicate this bug. Can you post the exact script that you are using, and also your matplotlibrc file (which you can find in $HOME/.matplotlib/matplotlibrc)? Then I can try and reproduce this. |
Sure. Before I do though, I’ve learned a little bit more. It appears that this is a conflict with the ete2 module for working with phylogenetic trees. If I don’t import ete2 (comment out the line), the MacOSX backend works fine. If I do import it, the window hangs. The CocoaAgg backend leads to a hanging window, regardless of whether or not ete2 is imported. Alternatively, I can use the TkAgg backend which sometimes (not always) leads to this error: called Tcl_FindHashEntry on deleted table This appears to be related to TK but I don’t know what it means. So for now I’m using the Qt4Agg backend, which for now appears to the most stable, although I prefer MacOSX or TkAgg. Here’s the script: import matplotlib.pyplot as plt And here’s the matplotlibrc file: MATPLOTLIBRC FORMATThis is a sample matplotlib configuration file - you can find a copyof it on your system insite-packages/matplotlib/mpl-data/matplotlibrc. If you edit itthere, please note that it will be overwritten in your next install.If you want to keep a permanent local copy that will not beoverwritten, place it in the following location:unix/linux:$HOME/.config/matplotlib/matplotlibrc or$XDG_CONFIG_HOME/matplotlib/matplotlibrc (if $XDG_CONFIG_HOME is set)other platforms:$HOME/.matplotlib/matplotlibrcSee http://matplotlib.org/users/customizing.html#the-matplotlibrc-file formore details on the paths which are checked for the configuration file.This file is best viewed in a editor which supports python modesyntax highlighting. Blank lines, or lines starting with a commentsymbol, are ignored, as are trailing comments. Other lines musthave the formatkey : val # optional commentColors: for the color values below, you can either use - amatplotlib color string, such as r, k, or b - an rgb tuple, such as(1.0, 0.5, 0.0) - a hex string, such as ff00ff or #ff00ff - a scalargrayscale intensity such as 0.75 - a legal html color name, e.g., red,blue, darkslategrayCONFIGURATION BEGINS HEREThe default backend; one of GTK GTKAgg GTKCairo GTK3Agg GTK3CairoCocoaAgg MacOSX Qt4Agg Qt5Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVGTemplate.You can also deploy your own backend outside of matplotlib byreferring to the module name (which must be in the PYTHONPATH) as'module://my_backend'.backend : MacOSX If you are using the Qt4Agg backend, you can choose hereto use the PyQt4 bindings or the newer PySide bindings tothe underlying Qt4 toolkit.#backend.qt4 : PySide # PyQt4 | PySide Note that this can be overridden by the environment variableQT_API used by Enthought Tool Suite (ETS); valid values are"pyqt" and "pyside". The "pyqt" setting has the side effect offorcing the use of Version 2 API for QString and QVariant.The port to use for the web server in the WebAgg backend.webagg.port : 8888If webagg.port is unavailable, a number of other random ports willbe tried until one that is available is found.webagg.port_retries : 50When True, open the webbrowser to the plot that is shownwebagg.open_in_browser : TrueWhen True, the figures rendered in the nbagg backend are created witha transparent background.nbagg.transparent : Trueif you are running pyplot inside a GUI and your backend choiceconflicts, we will automatically try to find a compatible one foryou if backend_fallback is True#backend_fallback: True #interactive : False Where your matplotlib data lives if you installed to a non-defaultlocation. This is where the matplotlib fonts, bitmaps, etc reside#datapath : /home/jdhunter/mpldata LINESSee http://matplotlib.org/api/artist_api.html#module-matplotlib.lines for moreinformation on line properties.#lines.linewidth : 1.0 # line width in points #markers.fillstyle: full # full|left|right|bottom|top|none PATCHESPatches are graphical objects that fill 2D space, like polygons orcircles. Seehttp://matplotlib.org/api/artist_api.html#module-matplotlib.patchesinformation on patch properties#patch.linewidth : 1.0 # edge width in points FONTfont properties used by text.Text. Seehttp://matplotlib.org/api/font_manager_api.html for moreinformation on font properties. The 6 font properties used for fontmatching are given below with their default values.The font.family property has five values: 'serif' (e.g., Times),'sans-serif' (e.g., Helvetica), 'cursive' (e.g., Zapf-Chancery),'fantasy' (e.g., Western), and 'monospace' (e.g., Courier). Each ofthese font families has a default list of font names in decreasingorder of priority associated with them. When text.usetex is False,font.family may also be one or more concrete font names.The font.style property has three values: normal (or roman), italicor oblique. The oblique style will be used for italic, if it is notpresent.The font.variant property has two values: normal or small-caps. ForTrueType fonts, which are scalable fonts, small-caps is equivalentto using a font size of 'smaller', or about 83% of the current fontsize.The font.weight property has effectively 13 values: normal, bold,bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as400, and bold is 700. bolder and lighter are relative values withrespect to the current weight.The font.stretch property has 11 values: ultra-condensed,extra-condensed, condensed, semi-condensed, normal, semi-expanded,expanded, extra-expanded, ultra-expanded, wider, and narrower. Thisproperty is not currently implemented.The font.size property is the default font size for text, given in pts.12pt is the standard value.#font.family : sans-serif note that font.size controls default text sizes. To configurespecial text sizes tick labels, axes, labels, title, etc, see the rcsettings for axes and ticks. Special text sizes can be definedrelative to font.size, using the following values: xx-small, x-small,small, medium, large, x-large, xx-large, larger, or smaller#font.size : 12.0 TEXTtext properties used by text.Text. Seehttp://matplotlib.org/api/artist_api.html#module-matplotlib.text for moreinformation on text properties#text.color : black LaTeX customizations. See http://wiki.scipy.org/Cookbook/Matplotlib/UsingTex#text.usetex : False # use latex for all text handling. The following fonts #text.dvipnghack : None # some versions of dvipng don't handle alpha #text.hinting : auto # May be one of the following: #text.antialiased : True # If True (default), the text will be antialiased. The following settings allow you to select the fonts in math mode.They map from a TeX font name to a fontconfig font pattern.These settings are only used if mathtext.fontset is 'custom'.Note that this "custom" mode is unsupported and may go away in thefuture.#mathtext.cal : cursive #mathtext.default : it # The default font to use for math. AXESdefault face and edge color, default tick sizes,default fontsizes for ticklabels, and so on. Seehttp://matplotlib.org/api/axes_api.html#module-matplotlib.axes#axes.hold : True # whether to clear the axes by default on #axes.formatter.limits : -7, 7 # use scientific notation if log10 #axes.unicode_minus : True # use unicode for the minus symbol #polaraxes.grid : True # display grid on polar axes TICKSsee http://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick#xtick.major.size : 4 # major tick size in points #ytick.major.size : 4 # major tick size in points GRIDS#grid.color : black # grid color Legend#legend.fancybox : False # if True, use a rounded box for the the following dimensions are in axes coords#legend.labelspacing : 0.5 # the vertical space between the legend entries in fraction of fontsize FIGURESee http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure#figure.titlesize : medium # size of the figure title The figure subplot parameters. All dimensions are a fraction of thefigure width or height#figure.subplot.left : 0.125 # the left side of the subplots of the figure IMAGES#image.aspect : equal # equal | auto | a number CONTOUR PLOTS#contour.negative_linestyle : dashed # dashed | solid ERRORBAR PLOTS#errorbar.capsize : 3 # length of end cap on error bars in pixels Agg renderingWarning: experimental, 2008/10/10#agg.path.chunksize : 0 # 0 to disable; values in the range SAVING FIGURES#path.simplify : True # When True, simplify paths by removing "invisible" the default savefig params can be different from the display paramse.g., you may want a higher resolution, or to make the figurebackground white#savefig.dpi : 100 # figure dots per inch tk backend params#tk.window_focus : False # Maintain shell focus for TkAgg ps backend params#ps.papersize : letter # auto, letter, legal, ledger, A0-A10, B0-B10 pdf backend params#pdf.compression : 6 # integer from 0 to 9 svg backend params#svg.image_inline : True # write raster image data directly into the svg file 'none': Assume fonts are installed on the machine where the SVG will be viewed.'path': Embed characters as paths -- supported by most SVG renderers'svgfont': Embed characters as SVG fonts -- supported only by Chrome,Opera and Safaridocstring params#docstring.hardcopy = False # set this when you want to generate hardcopy docstring Set the verbose flags. This controls how much informationmatplotlib gives you at runtime and where it goes. The verbositylevels are: silent, helpful, debug, debug-annoying. Any level isinclusive of all the levels below it. If your setting is "debug",you'll get all the debug and helpful messages. When submittingproblems to the mailing-list, please set verbose to "helpful" or "debug"and paste the output into your report.The "fileo" gives the destination for any calls to verbose.report.These objects can a filename, or a filehandle like sys.stdout.You can override the rc default verbosity from the command line bygiving the flags --verbose-LEVEL where LEVEL is one of the legallevels, e.g., --verbose-helpful.You can access the verbose instance in your codefrom matplotlib import verbose.#verbose.level : silent # one of silent, helpful, debug, debug-annoying Event keys to interact with figures/plots via keyboard.Customize these settings according to your needs.Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '')#keymap.fullscreen : f # toggling Control location of examples data files#examples.directory : '' # directory to look in for custom installation ###ANIMATION settings
|
@Auerilas Does the bug also appear if you don't import seaborn? |
Actually, ete2 import PyQt4, which has its own event loop. I expect that when you import PyQt4, its event loop starts to run, and the event loop in Tkinter or the MacOSX backend will stop. If so, there is not much you can do about it, other than to use PyQt4 in matplotlib as well. |
That would explain why the MacOSX and TK backends fail when I’m importing ete2. Thanks! For the record, this bug still appears for the CocoaAgg backend regardless of whether or not both seaborn or ete2 are imported.
|
Can you try to import PyQt4 (after importing matplotlib) to verify that that is sufficient to trigger the bug? |
This did not trigger the bug. import matplotlib.pyplot as plt I also tried it without seaborn as well.
|
But import matplotlib.pyplot as plt
import numpy as np
import ete2 as ete
x = np.arange(1,10)
plt.plot(x, x)
plt.show() gives you the bug? If so, can you find out which part of ete2 is causing this? I am seeing many imports like from PyQt4 import QtCore, QtGui in ete2; this may be the source of the bug. |
This: import matplotlib.pyplot as plt does not give me the bug as noted earlier. This: import matplotlib.pyplot as plt does, however. To narrow it down, I tried isolating QtCore and QtGui. Importing QtGui results in the bug: import matplotlib.pyplot as plt Importing QtCore also results in the bug. import matplotlib.pyplot as plt Importing QtSvg also results in the bug. import matplotlib.pyplot as plt So the bug doesn’t appear until I import specific modules within PyQt4.
|
The top-level of There is nothing we can do and this should maybe reported as a bug to |
@Auerilas Thank you. I would suggest to report this as a bug to PyQt4. If PyQt4 tries to set PyOS_InputHook and finds that it is already in use, it should raise an Exception or at least print a warning. |
Thanks. Will do.
|
I have had the same problem within I am using The simplest reproduction is trying to manually close the window after
even worse is attempting
|
@flipdazed I guess the behavior you are describing is similar to the one reported in #6838 . You may want to try the |
I have tried both cases of I have opened a StackOverflow post on the issue instead http://stackoverflow.com/questions/38801285/matplotlib-window-freezing-hanging-on-close-in-ipython-with-os-x |
I can reproduce this but I think it is a bug on the IPython side part of ipython/ipython#9659 This is as far as I know only an issue with the Mac OSX backend and caused by the OSX backend event loop integration in IPython not being updated to work with the new IPython based on prompt-toolkit. @flipdazed Would you mind opening a new issue for this since it's not really the same as this issue but an entirely new one caused by changes in IPython |
I had issues with this as well. I don’t remember how I resolved it, though. I know that’s not helpful, but I did want to mention that I was having the same problem.
|
Also having this issue. |
@jeffheaton The original issue behind this has been fixed for a long time you are likely seeing a related issue. It is probably better to open a new issue and describe what you are seeing in more detail and which versions you are using |
I'm running Python v2.7 and matplotlib v1.5.0 on Mac OS X Yosemite. Up to recently, I was able to run my script in the interactive interpreter, show a plot, and then manually kill the window. For example
This used to work fine. The window would close and I'd return to the prompt. However, now when I hit the red X to close the window, the window remains open. My command prompt returns and works fine, but the window is stuck and I see the spinning beach ball over it.
It's not until I run the script a second time that the first window closes, but then I'm stuck with a second open plot with the same problem. I'm a bit confused because this only happened recently. Up till now, the window would close fine.
It's not a huge issue, because Python still runs and I can still make new plots, but I'm curious as to why the window would all of a sudden stick open.
The text was updated successfully, but these errors were encountered: