#5301 closed defect (fixed)
[with spkg; positive review] In sage-3.3.rc2, doing sage -t -long "devel/sage/sage/plot/plot.py" causing a matplotlib GUI window to popup
Reported by: | was | Owned by: | was |
---|---|---|---|
Priority: | blocker | Milestone: | sage-3.3 |
Component: | graphics | Keywords: | |
Cc: | ghtdak, jason | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
This happens on OS X with a local GUI. Moreover, I get this doctest failure, which is perhaps related:
[2.5 s] sage -t -long "devel/sage/sage/plot/plot.py" ********************************************************************** File "/Users/wstein/build/build/sage-3.3.rc2/devel/sage/sage/plot/plot.py", line 173: sage: savefig('sage.png') Exception raised: Traceback (most recent call last): File "/Users/wstein/build/build/sage-3.3.rc2/local/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/Users/wstein/build/build/sage-3.3.rc2/local/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/Users/wstein/build/build/sage-3.3.rc2/local/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_0[61]>", line 1, in <module> savefig('sage.png')###line 173: sage: savefig('sage.png') File "/Users/wstein/build/build/sage-3.3.rc2/local/lib/python2.5/site-packages/matplotlib/pyplot.py", line 346, in savefig return fig.savefig(*args, **kwargs) File "/Users/wstein/build/build/sage-3.3.rc2/local/lib/python2.5/site-packages/matplotlib/figure.py", line 1001, in savefig self.canvas.print_figure(*args, **kwargs) File "/Users/wstein/build/build/sage-3.3.rc2/local/lib/python2.5/site-packages/matplotlib/backends/backend_macosx.py", line 268, in print_figure self.write_bitmap(filename, width, height) ValueError: Unknown file type ********************************************************************** 1 items had failures:
Change History (11)
comment:1 Changed 12 years ago by
- Cc ghtdak added
comment:2 Changed 12 years ago by
- Cc jason added
Oops, forgot to add Jason to the CC :)
Cheers,
Michael
comment:3 Changed 12 years ago by
I think there are two separate problems:
(1)
sage: from pylab import * sage: t = arange(0.0, 2.0, 0.01) sage: s = sin(2*pi*t) sage: P = plot(t, s, linewidth=1.0) [a popup appears]
(2) then do the following one line after the above:
sage: savefig('sage.png') BOOM ValueError: Unknown file type
Other remarks:
- This bug occurs exactly the same in the notebook, so is a major show stopper.
- There is probably a way to get around it, since of course our own matplotlib-based plotting works fine without popping up GUI's and writing to files.
I'm guessing the the best fix is to patch setup.py to avoid building any GUI backends for now, until we can figure out how to patch pylab itself to not use the GUI backends. I mean, given that one has built any GUI backend, the above behavior (sans the savefig issue) definitely seems like appropriate behavior for matplotlib.
comment:4 Changed 12 years ago by
Further remarks:
- I built the new matplotlib into sage-3.3.alpha5, which has the previous libpng spkg and both the popup and rendering of png problems vanished. So the real bug is probably in libpng/matplotlib interaction.
- I build without the OS X gui backend and the problem vanishes for OS X.
A quick fix for sage-3.3.rc3 would be to disable the OS X GUI. This can be done with a one line change to setup.py (just put an if False in the part of setup.py that involves that macos X gui), or something involving setup.cfg or something more complicated to setup.py.
comment:5 Changed 12 years ago by
- Summary changed from In sage-3.3.rc2, doing sage -t -long "devel/sage/sage/plot/plot.py" causing a matplotlib GUI window to popup to [with spkg; needs review] In sage-3.3.rc2, doing sage -t -long "devel/sage/sage/plot/plot.py" causing a matplotlib GUI window to popup
I will post an spkg that fixes this in a second. Take it or leave it. At least it will make it possible to release sage-3.3 It only disables GUI's by default on OS X, and creates an environment variable to control this in general. If somebody wants to somehow redo this use setup.cfg, be my guest.
comment:6 Changed 12 years ago by
comment:7 Changed 12 years ago by
- Summary changed from [with spkg; needs review] In sage-3.3.rc2, doing sage -t -long "devel/sage/sage/plot/plot.py" causing a matplotlib GUI window to popup to [with spkg; positive review] In sage-3.3.rc2, doing sage -t -long "devel/sage/sage/plot/plot.py" causing a matplotlib GUI window to popup
Positive review. I checked in one diff as unified diff, but other than that no changes.
Cheers,
Michael
comment:8 Changed 12 years ago by
- Resolution set to fixed
- Status changed from new to closed
Merged the spkg at
in Sage 3.3.rc3.
Cheers,
Michael
comment:9 Changed 12 years ago by
For the record: I did turn off GUI support per default since it causes trouble on X less boxen, i.e. sage.math. This might very well be a bug in the new MPL, so someone should check with them why the inport of tcl or pygtk is not caught and dealt with appropriately. I talked all this over with William and he agreed with me that this is the right fix for 3.3, but that the issue should be revisited. The spkg at
was merged in 3.3.rc3 and replaced the one mentioned above.
Cheers,
Michael
comment:10 Changed 12 years ago by
Instructions for reenabling the gui backends are:
set the environment variable SAGE_MATPLOTLIB_GUI to anything besides 'no'
Reinstall the spkg: sage -f matplotlib-0.98.5.3rc0-svn6910.p3
comment:11 Changed 6 years ago by
- Description modified (diff)
- Report Upstream set to N/A
This problem is caused by this code snipped:
Glenn has reported the same issue on a Linux box. This might be a genuine bug in MPL.
Cheers,
Michael