Installing under Leopard (Mac OSX 10.5)

sent to: matplotlib-users@lists.sourceforge.net

I'm attempting to install matplotlib under version 10.5 ("Leopard") of the Macintosh operating system.

I had an old installation, via Fink, which broke when I (foolishly) upgraded from version 10.4 to version 10.5.

In principle, installing matplotlib under 10.5 should be simple, because Leopard already includes all of matplotlib's dependencies:
  Python 2.4 (and 2.5)
  numpy
  libpng
  zlib
  freetype
  
In practice, I seem to be running into trouble with freetype.

I built matplotlib version 0.90.1 from source, and installed it in /Library/Python/2.5/site-packages

When I run python2.5 and import pylab, the import looks for freetext.6.dylib in /sw/lib/freetype219/lib/libfreetype.6.dylib (i.e. the broken Fink installation, incompatable with Leopard) which results in a bus error. (My reasons for this assertion are given below.) There's a (presumably Leopard-compatable) version of libfreetype.6.dylib in /usr/X11/lib/libfreetype.6.dylib

...so, my problem seems to be, how do I get matplotlib to look for libfreetype.6.dylib in the right place?

I have tried changing setup.py Specifically, I've replaced
  'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local', '/usr', '/sw'],
with
  'darwin' : ['/usr/X11', '/usr/X11/lib', '/usr/X11/include', '/usr/X11/include/freetype2', '/usr/local','/usr'],
Which does not solve the problem (does not change anything at all, as far as I can tell).

I've not been able to locate an explicit reference to the /sw directory anywhere else in setupext.py, or in setup.py

APPENDIX: why am I convinced that pylab is looking for freetype.6.dylib in /sw/lib/freetype219/lib/ ?

First, when I get the bus error, a window pops up saying that Python's "unexpected quit" (=crash) may be due to "freetype.6.dylib"

Second, when I click the "report" button in this window, I see many pages of debugging info which I don't know how to interpret, but which includes this line:
  0x1226000 - 0x1279ff3 +libfreetype.6.dylib ??? (???) /sw/lib/freetype219/lib/libfreetype.6.dylib
  
Third, when I temporarily remove the entire /sw/lib/freetype219 directory from /sw/lib then run python2.5 and import pylab, I no longer get a bus error, but I *do* now get *this* error:
  ImportError: dlopen(/Library/Python/2.5/site-packages/matplotlib/ft2font.so, 2): Library not loaded: /sw/lib/freetype219/lib/libfreetype.6.dylib
   Referenced from: /Library/Python/2.5/site-packages/matplotlib/ft2font.so
   Reason: image not found

I am going to try some monkey business along the lines of
  ln /usr/X11/lib/libfreetype.6.dylib /sw/lib/freetype219/lib/libfreetype.6.dylib
and will let you know the results. However, even if that works, it's a heinous kluge, and probably fragile, too.

I am having a similar problem. However I can't seem to get matplotlib
to compile at all. It fails when it can't find png.h.
At the beginning, it says it can find freetype and libpng, but can't
find the appropriate header files. I have found them here:

/Developer/SDKs/MacOSX10.5.sdk/usr/X11/include

So the question is, how can I/we get matplotlib to use the included
versions of freetype and libpng instead of downloading and compiling
other versions?

Thanks,
Jeremy

···

On Nov 13, 2007 11:01 AM, Scott Cooper <sec6@...253...> wrote:

sent to: matplotlib-users@lists.sourceforge.net

I'm attempting to install matplotlib under version 10.5 ("Leopard") of
the Macintosh operating system.

I had an old installation, via Fink, which broke when I (foolishly)
upgraded from version 10.4 to version 10.5.

In principle, installing matplotlib under 10.5 should be simple,
because Leopard already includes all of matplotlib's dependencies:
        Python 2.4 (and 2.5)
        numpy
        libpng
        zlib
        freetype

In practice, I seem to be running into trouble with freetype.

I built matplotlib version 0.90.1 from source, and installed it in /
Library/Python/2.5/site-packages

When I run python2.5 and import pylab, the import looks for freetext.
6.dylib in /sw/lib/freetype219/lib/libfreetype.6.dylib (i.e. the
broken Fink installation, incompatable with Leopard) which results in
a bus error. (My reasons for this assertion are given below.) There's
a (presumably Leopard-compatable) version of libfreetype.6.dylib in /
usr/X11/lib/libfreetype.6.dylib

...so, my problem seems to be, how do I get matplotlib to look for
libfreetype.6.dylib in the right place?

I have tried changing setup.py Specifically, I've replaced
        'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local',
'/usr', '/sw'],
with
        'darwin' : ['/usr/X11', '/usr/X11/lib', '/usr/X11/include', '/usr/X11/
include/freetype2', '/usr/local','/usr'],
Which does not solve the problem (does not change anything at all, as
far as I can tell).

I've not been able to locate an explicit reference to the /sw
directory anywhere else in setupext.py, or in setup.py

APPENDIX: why am I convinced that pylab is looking for freetype.
6.dylib in /sw/lib/freetype219/lib/ ?

First, when I get the bus error, a window pops up saying that Python's
"unexpected quit" (=crash) may be due to "freetype.6.dylib"

Second, when I click the "report" button in this window, I see many
pages of debugging info which I don't know how to interpret, but which
includes this line:
        0x1226000 - 0x1279ff3 +libfreetype.6.dylib ??? (???) /sw/lib/
freetype219/lib/libfreetype.6.dylib

Third, when I temporarily remove the entire /sw/lib/freetype219
directory from /sw/lib then run python2.5 and import pylab, I no
longer get a bus error, but I *do* now get *this* error:
        ImportError: dlopen(/Library/Python/2.5/site-packages/matplotlib/
ft2font.so, 2): Library not loaded: /sw/lib/freetype219/lib/
libfreetype.6.dylib
   Referenced from: /Library/Python/2.5/site-packages/matplotlib/
ft2font.so
   Reason: image not found

I am going to try some monkey business along the lines of
        ln /usr/X11/lib/libfreetype.6.dylib /sw/lib/freetype219/lib/
libfreetype.6.dylib
and will let you know the results. However, even if that works, it's
a heinous kluge, and probably fragile, too.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Scott Cooper wrote:

sent to: matplotlib-users@lists.sourceforge.net

I'm attempting to install matplotlib under version 10.5 ("Leopard") of
the Macintosh operating system.

I had an old installation, via Fink, which broke when I (foolishly)
upgraded from version 10.4 to version 10.5.

You might want to try reinstalling Fink. I did a bootstrap install of Fink
on a new 10.5 install and matplotlib is working fine. Several other tools
that I use are still missing from Fink on 10.5 but I haven't had any
problems with matplotlib so far.

Best of luck,

···

--
Jed Frechette
University of New Mexico Lidar Lab
--
View this message in context: http://www.nabble.com/Installing-under-Leopard-(Mac-OSX-10.5)-tf4798891.html#a13754006
Sent from the matplotlib - users mailing list archive at Nabble.com.

Jed Frechette wrote:

Scott Cooper wrote:

sent to: matplotlib-users@lists.sourceforge.net

I'm attempting to install matplotlib under version 10.5 ("Leopard") of
the Macintosh operating system.

I had an old installation, via Fink, which broke when I (foolishly)
upgraded from version 10.4 to version 10.5.

You might want to try reinstalling Fink. I did a bootstrap install of Fink
on a new 10.5 install and matplotlib is working fine. Several other tools
that I use are still missing from Fink on 10.5 but I haven't had any
problems with matplotlib so far.

Best of luck,

--
Jed Frechette
University of New Mexico Lidar Lab

Per Jed's suggestion, I did a boostrap install of Fink, into a virgin /sw
directory, then
     /sw/bin/fink --trees=unstable install matplotlib-py24

which failed with
  Could not resolve inconsistent dependencies!
  Fink isn't sure how to install the above packages safely. You may be able
to fix things by running:
    fink scanpackages
    sudo apt-get update
    sudo apt-get install bzip2-dev=1.0.3-1 bzip2-shlibs=1.0.3-1

which I did, with the following result:
  Sorry, bzip2-dev is already the newest version.
  Sorry, bzip2-shlibs is already the newest version.
  0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

···

--
View this message in context: http://www.nabble.com/Installing-under-Leopard-(Mac-OSX-10.5)-tf4798891.html#a13761021
Sent from the matplotlib - users mailing list archive at Nabble.com.

sec6 wrote:

sent to: matplotlib-users@lists.sourceforge.net

I'm attempting to install matplotlib under version 10.5 ("Leopard") of
the Macintosh operating system.

I had an old installation, via Fink, which broke when I (foolishly)
upgraded from version 10.4 to version 10.5.

In principle, installing matplotlib under 10.5 should be simple,
because Leopard already includes all of matplotlib's dependencies:
  Python 2.4 (and 2.5)
  numpy
  libpng
  zlib
  freetype
  
In practice, I seem to be running into trouble with freetype.

...snip...

I am going to try some monkey business along the lines of
  ln /usr/X11/lib/libfreetype.6.dylib /sw/lib/freetype219/lib/
libfreetype.6.dylib
and will let you know the results. However, even if that works, it's
a heinous kluge, and probably fragile, too.

Jed's solution (bootstrap Fink from scratch) didn't work for me (Bootstrap
worked OK, but installing matplotlib failed with "Could not resolve
inconsistent dependencies!")

However, I have now tried the "monkey business" alluded to above, and it was
successful.
#Start by launching XWindows. now:
  cd /sw/lib/freetype219/lib
  sudo ln -s /usr/X11/lib/libfreetype.6.dylib ./libfreetype.6.dylib
  <...enters password...>
  cd ~
  pythonw2.5
  >>> import pylab
#Bingo! no error.
  >>> fig = pylab.figure()
#Empty window appears on screen.
  >>> pylab.plot([1,2,3],[1,2,3])
  [<matplotlib.lines.Line2D instance at 0x163e558>]
#Correct plot appears in window
  >>> fig.savefig('/Users/username/Desktop/temp.ps')
#Open temp.ps in a graphics program (Canvas, as it happens). Looks good.

Using pythonw, rather than python, is important.
With pythonw, pylab.figure() displays the figure, whereas with plain python,
the figure doesn't display untill you do pylab.show().
Also, with plain python, you don't get the ">>>" prompt back 'till you close
the figure window, whereas with pythonw you get it back as soon as the
figure's displayed.
That last is important to me, because it replicates the (to me) single moust
useful thing about ipython. That means I *don't* need to install ipython,
now.

I still hope somebody more expert will discover a less ugly, more general,
and less fragile solution.

···

--
View this message in context: http://www.nabble.com/Installing-under-Leopard-(Mac-OSX-10.5)-tf4798891.html#a13777470
Sent from the matplotlib - users mailing list archive at Nabble.com.

I still hope somebody more expert will discover a less ugly, more general,
and less fragile solution.

Would using macports be an acceptable/less fragile solution for you?

My matplotlib (and pretty much everything) install via macports survived my Tiger -> Leopard upgrade (I did an archive install) just fine.

Its dependency stuff requires you to intsall numpy via macports as well, but I think what I did was (long time ago now):

$ sudo port install py-matplotlib

To get everything up and running. At some later point I uninstalled py-numpy and py-matplotlib (it kept the rest of the dependencies) and have since been compiling them from svn.

Everything seems to be working well for me.

Also, with plain python, you don't get the ">>>" prompt back 'till you close
the figure window, whereas with pythonw you get it back as soon as the
figure's displayed.
That last is important to me, because it replicates the (to me) single moust
useful thing about ipython. That means I *don't* need to install ipython,
now.

I find ipython to be indispensable for many more reasons than just that. For instance, I just (relatively) recently was made aware of the "%debug" trick that will drop you into where your last Error was raised if your script bombs out so that you can poke around to see what went wrong. So cool ... but, hey, whatever floats your boat :slight_smile:

-steve