problem importing pylab on OSX

I've just finished to install matplotlib on mac os X panther and when I try to import pylab, i have got the following error:

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/pylab.py", line 1, in ?
     from matplotlib.pylab import *
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py", line 195, in ?
     from axes import Axes, PolarAxes
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py", line 14, in ?
     from axis import XAxis, YAxis
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axis.py", line 21, in ?
     from font_manager import FontProperties
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 982, in ?
     fontManager = FontManager()
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 826, in __init__
     rebuild()
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 819, in rebuild
     self.ttfdict = createFontDict(self.ttffiles)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 458, in createFontDict
     prop = ttfFontProperty(font)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 271, in ttfFontProperty
     sfnt = font.get_sfnt()
RuntimeError: No SFNT name table

Could anyone help with this issue? Many thanks

Brice

Hi,

(I am assuming you've built your own copy of matplotlib)

This usually happens when matplotlib's ft2font.so links against OS X's
copy of freetype, instead of a newer copy (which you have to install).
The copy of freetype with OS X is too old to figure out some of the
newer fonts (especially asian ones) installed on OS X.

You can verify that it is linked against
/usr/X11R6/lib/libfreetype.6.dylib using:

$ otool -L /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/ft2font.so
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/ft2font.so:
        /opt/local/lib/libfreetype.6.dylib (compatibility version
10.0.0, current version 10.7.0)
...
(In my case I've linked against darwinports' freetype)

AFAIK matplotlib will find fink's freetype automatically when
building, if you install fink from http://fink.sourceforge.net/ and
install freetype219 ("$ fink install freetype219"), then rebuild
matplotlib all should be well.

Michael

···

On 6/14/05, Brice Thurin <B.P.S.Thurin@...648...> wrote:

I've just finished to install matplotlib on mac os X panther and when I
try to import pylab, i have got the following error:

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/pylab.py", line 1, in ?
     from matplotlib.pylab import *
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/pylab.py", line 195, in ?
     from axes import Axes, PolarAxes
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/axes.py", line 14, in ?
     from axis import XAxis, YAxis
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/axis.py", line 21, in ?
     from font_manager import FontProperties
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 982, in ?
     fontManager = FontManager()
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 826, in __init__
     rebuild()
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 819, in rebuild
     self.ttfdict = createFontDict(self.ttffiles)
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 458, in createFontDict
     prop = ttfFontProperty(font)
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 271, in ttfFontProperty
     sfnt = font.get_sfnt()
RuntimeError: No SFNT name table

Could anyone help with this issue? Many thanks

Brice

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Michael Twomey wrote:

AFAIK matplotlib will find fink's freetype automatically when
building, if you install fink from http://fink.sourceforge.net/ and
install freetype219 ("$ fink install freetype219"), then rebuild
matplotlib all should be well.

You have a couple other options as well:

darwinports freetype ( I haven't used it, but it should exist)

the freetype tarball.

I ready-to-go binary installer. There is an older one at pythonmac.org/packages, and I'm in the process of building some newer ones. I've enclosed my instructions on how to build them here, if you want to do it yourself. If you find anything errors, or things that need clarifying, please let me know. It is a draft, so don't be too critical.

-Chris

BuildingMatplotlib.txt (8.96 KB)

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Thank you for your response.
I have been trying to follow your instruction, but still have the same error message. Matplotlib's ft2font.so links against /usr/local/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.8.0), which should be alright (I check with the install of freetype it has been installed in this folder).

could you give anymore hints...

Thanks
Brice

Hi,

(I am assuming you've built your own copy of matplotlib)

This usually happens when matplotlib's ft2font.so links against OS X's
copy of freetype, instead of a newer copy (which you have to install).
The copy of freetype with OS X is too old to figure out some of the
newer fonts (especially asian ones) installed on OS X.

You can verify that it is linked against
/usr/X11R6/lib/libfreetype.6.dylib using:

$ otool -L /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/ft2font.so
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/ft2font.so:
        /opt/local/lib/libfreetype.6.dylib (compatibility version
10.0.0, current version 10.7.0)
...
(In my case I've linked against darwinports' freetype)

AFAIK matplotlib will find fink's freetype automatically when
building, if you install fink from http://fink.sourceforge.net/ and
install freetype219 ("$ fink install freetype219"), then rebuild
matplotlib all should be well.

Michael

I've just finished to install matplotlib on mac os X panther and when I
try to import pylab, i have got the following error:

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/pylab.py", line 1, in ?
     from matplotlib.pylab import *
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/pylab.py", line 195, in ?
     from axes import Axes, PolarAxes
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/axes.py", line 14, in ?
     from axis import XAxis, YAxis
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/axis.py", line 21, in ?
     from font_manager import FontProperties
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 982, in ?
     fontManager = FontManager()
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 826, in __init__
     rebuild()
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 819, in rebuild
     self.ttfdict = createFontDict(self.ttffiles)
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 458, in createFontDict
     prop = ttfFontProperty(font)
   File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/font_manager.py", line 271, in ttfFontProperty
     sfnt = font.get_sfnt()
RuntimeError: No SFNT name table

Could anyone help with this issue? Many thanks

Brice

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Brice Thurin

Department of Optometry and Visual Science
City University, Northampton Square
London, EC1V 0HB, UK.
http://www.city.ac.uk/optometry/Luis/myresearch/Research/scatteringproper.html
http://www.sharpeye.org/

Tel: +44 (0)20 7040 4157
Fax: +44(0)20 7040 8355
e-mail: B.P.S.Thurin@...648...

···

On 14 Jun 2005, at 15:09, Michael Twomey wrote:

On 6/14/05, Brice Thurin <B.P.S.Thurin@...648...> wrote:

Rats, this looks like it should work.

I'd recommend trying Chris's binary package when he gets it done
(Chris, do you need any help on that front?).

You could try a completely fresh rebuild:

1. Completely remove
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-

packages/matplotlib/

2. Completely remove the build directory from your matplotlib-0.81 source tree
3. try the setup.py build again

It's possible there is something which didn't cleanly relink itself.

Failing that it's probably going to be one of those annoying retry
step by step moments.

Michael

···

On 6/15/05, Brice Thurin <B.P.S.Thurin@...648...> wrote:

Thank you for your response.
I have been trying to follow your instruction, but still have the same
error message. Matplotlib's ft2font.so links against
/usr/local/lib/libfreetype.6.dylib (compatibility version 10.0.0,
current version 10.8.0), which should be alright (I check with the
install of freetype it has been installed in this folder).

could you give anymore hints...

Thanks
Brice

Michael Twomey wrote:

I'd recommend trying Chris's binary package when he gets it done
(Chris, do you need any help on that front?).

Well, not for what I intend to do, but I wasn't planning on building in PyGTK support. In a way, doing that is contrary to my goal, which is a package that can be installed on a stock OS-X (except Numerix, of course). i.e. fink-free.

However, it would probably work fine to have GTK compiled into the binary, and it shouldn't break any of the other back-ends...it just wouldn't work with PyGTK if PyGTK wasn't there, which is kind of obvious.

So, if someone want to build a package with PyGTK support, I'll send you what I have to docs, and you can go to it. I'd love for there to be only one "official" package, so if someone makes a superset of mine, I won't distribute mine.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Hello,

I still have the same error, same with the binary package:

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/pylab.py", line 1, in ?
     from matplotlib.pylab import *
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py", line 198, in ?
     from axes import Axes, PolarAxes
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py", line 14, in ?
     from axis import XAxis, YAxis
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axis.py", line 21, in ?
     from font_manager import FontProperties
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 982, in ?
     fontManager = FontManager()
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 826, in __init__
     rebuild()
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 819, in rebuild
     self.ttfdict = createFontDict(self.ttffiles)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 458, in createFontDict
     prop = ttfFontProperty(font)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/font_manager.py", line 271, in ttfFontProperty
     sfnt = font.get_sfnt()
RuntimeError: No SFNT name table

Many Thanks for your help

Brice

···

On 15 Jun 2005, at 18:58, Chris Barker wrote:

Michael Twomey wrote:

I'd recommend trying Chris's binary package when he gets it done
(Chris, do you need any help on that front?).

Well, not for what I intend to do, but I wasn't planning on building in PyGTK support. In a way, doing that is contrary to my goal, which is a package that can be installed on a stock OS-X (except Numerix, of course). i.e. fink-free.

However, it would probably work fine to have GTK compiled into the binary, and it shouldn't break any of the other back-ends...it just wouldn't work with PyGTK if PyGTK wasn't there, which is kind of obvious.

So, if someone want to build a package with PyGTK support, I'll send you what I have to docs, and you can go to it. I'd love for there to be only one "official" package, so if someone makes a superset of mine, I won't distribute mine.

-Chris

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users