Skip to content
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

os x -- 10.6 -- generated the matplotlib font cache crashes sage #7022

Closed
williamstein opened this issue Sep 27, 2009 · 18 comments
Closed

os x -- 10.6 -- generated the matplotlib font cache crashes sage #7022

williamstein opened this issue Sep 27, 2009 · 18 comments

Comments

@williamstein
Copy link
Contributor

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:

http://wstein.org/home/wstein/tmp/fontList.cache

Component: graphics

Author: William Stein

Reviewer: Mike Hansen

Merged: Sage 4.1.2.rc0

Issue created by migration from https://trac.sagemath.org/ticket/7022

@williamstein williamstein added this to the sage-4.1.2 milestone Sep 27, 2009
@williamstein williamstein self-assigned this Sep 27, 2009
@williamstein

This comment has been minimized.

@williamstein
Copy link
Contributor Author

comment:2

The spkg is here:

http://wstein.org/home/wstein/patches/matplotlib-0.99.1.p1.spkg

This supersedes what is at #6994.

The attached package only patches Matplotlib on OS X 10.6 by changing one line to use

@williamstein williamstein changed the title os x -- 10.6 -- generated the matplotlib font cache crashes sage [not yet ready for review] os x -- 10.6 -- generated the matplotlib font cache crashes sage Sep 27, 2009
@williamstein
Copy link
Contributor Author

comment:3

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.

@williamstein
Copy link
Contributor Author

comment:4

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    

@williamstein
Copy link
Contributor Author

comment:5

How about

import matplotlib.ft2font; matplotlib.ft2font.FT2Font('/Library/Fonts/NISC18030.ttf')

@williamstein williamstein changed the title [not yet ready for review] os x -- 10.6 -- generated the matplotlib font cache crashes sage os x -- 10.6 -- generated the matplotlib font cache crashes sage Sep 27, 2009
@williamstein
Copy link
Contributor Author

comment:7

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

@williamstein
Copy link
Contributor Author

comment:8

OK, even this doesn't fix the problem on all machines. E.g., on bsd.math.washington.edu it does not fix the problem.

@williamstein
Copy link
Contributor Author

comment:9

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.

@williamstein
Copy link
Contributor Author

@williamstein
Copy link
Contributor Author

comment:11

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.

@williamstein
Copy link
Contributor Author

comment:12

By the way, here is a simple test that things are working:

sage: import pylab
sage: plot(sin).save('a.pdf')

@mwhansen
Copy link
Contributor

comment:13

Looks good to me. Everything worked for me on bsd.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 30, 2009

Merged: Sage 4.1.2.rc0

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 30, 2009

Author: William Stein

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 30, 2009

comment:14

Merged matplotlib-0.99.1.p2.spkg in the standard packages repository.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 30, 2009

Reviewer: Mike Hansen

@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Sep 30, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin reopened this Sep 30, 2009
@jhpalmieri
Copy link
Member

comment:15

I'm still getting a crash with lines like these:

sage: import pylab
sage: plot(sin).save('a.pdf')

I made a related comment at #7095 because I didn't know about this ticket. Also, as opposed to this ticket, #7095 is still open, so further discussion should continue there (or on a new ticket?).

@jhpalmieri
Copy link
Member

comment:16

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 https://github.com/sagemath/sage-prod/issues/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.)

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

3 participants