#7022 closed defect (fixed)
[with spkg, positive review] os x -- 10.6 -- generated the matplotlib font cache crashes sage
Reported by: | was | Owned by: | was |
---|---|---|---|
Priority: | blocker | Milestone: | sage-4.1.2 |
Component: | graphics | Keywords: | |
Cc: | Merged in: | Sage 4.1.2.rc0 | |
Authors: | William Stein | Reviewers: | Mike Hansen |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
This is a huge problem and total blocker:
flat:.matplotlib wstein$ mv fontList.cache fontList.cache.XXX flat:.matplotlib wstein$ cd flat:~ wstein$ sage ---------------------------------------------------------------------- | Sage Version 4.1.1, Release Date: 2009-08-14 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- Loading Sage library. Current Mercurial branch is: parallel sage: import pylab /Users/wstein/sage/build/64bit/sage/local/bin/sage-sage: line 199: 58213 Abort trap sage-ipython "$@" -i flat:.matplotlib wstein$ mv fontList.cache.XXX fontList.cache flat:.matplotlib wstein$ cd .. flat:~ wstein$ sage ---------------------------------------------------------------------- | Sage Version 4.1.1, Release Date: 2009-08-14 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- Loading Sage library. Current Mercurial branch is: parallel sage: import pylab sage:
Ideas for solution:
(1) track down exactly where the problem happens in the matplotlib/freetype(?) code and fix it.
(2) Just ship the font cache with Sage until this gets resolved upstream
A working version of the fontcache is here:
Change History (16)
comment:1 Changed 7 years ago by
- Description modified (diff)
comment:2 Changed 7 years ago by
- Summary changed from os x -- 10.6 -- generated the matplotlib font cache crashes sage to [with patch; not yet ready for review] os x -- 10.6 -- generated the matplotlib font cache crashes sage
comment:3 Changed 7 years ago by
Doctesting reveals that just using FONTCONFIG is not enough, e.g., any saving to pdf still breaks.
Here is the problem narrowed down more:
sage: import ft2font; ft2font.FT2Font('/Library/Fonts/NISC18030.ttf') /Users/wstein/sage/build/64bit/sage-4.1.2.alpha1/local/bin/sage-sage: line 199: 65960 Abort trap sage-ipython "$@" -i
ft2font.so is a C extension in matplotlib.
comment:4 Changed 7 years ago by
above it should be
sage: import matplotlib.ft2font; ft2font.FT2Font('/Library/Fonts/NISC18030.ttf') /Users/wstein/sage/build/64bit/sage-4.1.2.alpha1/local/bin/sage-sage: line 199: 65960 Abort trap
comment:5 Changed 7 years ago by
How about
import matplotlib.ft2font; matplotlib.ft2font.FT2Font('/Library/Fonts/NISC18030.ttf')
comment:6 Changed 7 years ago by
- Summary changed from [with patch; not yet ready for review] os x -- 10.6 -- generated the matplotlib font cache crashes sage to [with patch; needs review] os x -- 10.6 -- generated the matplotlib font cache crashes sage
comment:7 Changed 7 years ago by
- Summary changed from [with patch; needs review] os x -- 10.6 -- generated the matplotlib font cache crashes sage to [with spkg; needs review] os x -- 10.6 -- generated the matplotlib font cache crashes sage
I found yet another issue (X11 must be in the PATH), but this spkg fixes that issue too:
http://wstein.org/home/wstein/patches/matplotlib-0.99.1.p1.spkg
comment:8 Changed 7 years ago by
- Summary changed from [with spkg; needs review] os x -- 10.6 -- generated the matplotlib font cache crashes sage to [with spkg; needs work] os x -- 10.6 -- generated the matplotlib font cache crashes sage
OK, even this doesn't fix the problem on all machines. E.g., on bsd.math.washington.edu it does not fix the problem.
comment:9 Changed 7 years ago by
Comment -- upgrading freetype doesn't fix the problems at all. Also, upgrading freetype is itself broken, and the only workaround that I found that worked was to alias "rm" to be "rm -f" -- then freetype built and installed fine.
comment:10 Changed 7 years ago by
comment:11 Changed 7 years ago by
- Summary changed from [with spkg; needs work] os x -- 10.6 -- generated the matplotlib font cache crashes sage to [with spkg; needs review] os x -- 10.6 -- generated the matplotlib font cache crashes sage
This spkg fixes the problems on all my test systems:
http://sage.math.washington.edu/home/wstein/patches/matplotlib-0.99.1.p2.spkg
All it does is take the plane vanilla matplotlib-0.99.1.spkg spkg and add a little script that simply rebuilds f2font.so again using *exactly* the same command lines used by distutils to build that extension. That's it. For some reason -- probably involving environment variables (?) -- this fixes the problem. I consider this a temporary 1-sage release solution until the matplotlib developers (or me) come up with a real fix.
comment:12 Changed 7 years ago by
By the way, here is a simple test that things are working:
sage: import pylab sage: plot(sin).save('a.pdf')
comment:13 Changed 7 years ago by
- Summary changed from [with spkg; needs review] os x -- 10.6 -- generated the matplotlib font cache crashes sage to [with spkg; positive review] os x -- 10.6 -- generated the matplotlib font cache crashes sage
Looks good to me. Everything worked for me on bsd.
comment:14 Changed 7 years ago by
- Merged in set to Sage 4.1.2.rc0
- Resolution set to fixed
- Reviewers set to Mike Hansen
- Status changed from new to closed
- Summary changed from [with spkg; positive review] os x -- 10.6 -- generated the matplotlib font cache crashes sage to [with spkg, positive review] os x -- 10.6 -- generated the matplotlib font cache crashes sage
Merged matplotlib-0.99.1.p2.spkg
in the standard packages repository.
comment:15 Changed 7 years ago by
- Report Upstream set to N/A
comment:16 Changed 7 years ago by
The matplotlib problem may be in its spkg file: it says
if [ $UNAME = "Darwin" -a `uname -r` = "10.0.0" ]; then echo "Running a horrible hack to force ft2font.so to build in a way that doen't crash." echo "This is of course temporary. See http://trac.sagemath.org/sage_trac/ticket/7022" ../patches/osx10.6hack fi
But with my computer, "uname -r" returns "10.2.0", not "10.0.0". How do you modify a shell script like this to make it work for a range of version numbers? (We don't just want "10.0.0" or "10.2.0", I'm guessing.)
The spkg is here:
This supersedes what is at #6994.
The attached package *only* patches Matplotlib on OS X 10.6 by changing one line to use