installation of matplotlib on OS X 10.5 with python.org Python 2.6

Hi, I am having trouble installing matplotlib. I have OS X 10.5 with Python 2.6
downloaded and installed from python.org .
(10.5 came with Apple
Python 2.5). I’ve also installed NumPy and SciPy for Python 2.6.

I’ve
tried EasyInstall, svn, and dmg. The dmg expects Apple Python 2.6 so that’s out. For the EasyInstall and svn routes I think I must be missing
some external libraries? Below are some snippets of warnings/error messages:

from EasyInstall:
$ easy_install matplotlib

      matplotlib: 0.99.3

warning: no files found matching ‘MANIFEST’
warning: no files found matching ‘lib/mpl_toolkits’
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of
required architecture
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required architecture
ld
warning: in /opt/local/lib/libz.dylib, file is not of required architecture
ld warning: in /opt/local/lib/libpng12.dylib, file is not of required architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required architecture
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of
required architecture
ld: in /opt/local/lib/libxml2.2.dylib, file is
not of required architecture for architecture ppc
collect2: ld returned 1 exit status
ld
warning: duplicate dylib /opt/local/lib/libz.1.dylib
lipo: can’t open input file: /var/folders/Yh/Yh3On1j+FXW+r-334Wk-vk+++TI/-Tmp-//ccWD9nm4.out (No such
file or directory)
error: Setup script exited with error: command ‘c++’ failed with exit status 1

from SVN:
$ python setup.py build
matplotlib: 1.0.svn
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required architecture
ld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture for architecture ppc
collect2: ld returned 1 exit status
ld warning: duplicate dylib /opt/local/lib/libz.1.dylib
lipo: can’t open
input file: /var/folders/Yh/Yh3On1j+FXW+r-334Wk-vk+++TI/-Tmp-//cc6cv190.out (No such
file or directory)
error: command ‘c++’ failed with exit status 1

and
in both throughout the messages there are references to “linker input file unused because linking not done” for
powerpc-apple-darwin9-gcc-4.0.1
and i686-apple-darwin9-gcc-4.0.1.

I’d tried the EPD version also
(and had it working), but then EasyInstall would direct me to their repositories (for which I did not have a password) so I could not download and install RPy2 and other modules (easily), so I decided to build up from individual components…

Any advice you can provide on helping me complete the matplotlib installation? I think after this I will have the basics for data analysis in Python (with NumPy and SciPy).

Thanks!
Stephen

···

The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. Get busy.

resending to the list too, fwiw.

2010/7/5 Stephen T. <obsessively@...32...>:

Hi, I am having trouble installing matplotlib. I have OS X 10.5 with Python
2.6 downloaded and installed from python.org. (10.5 came with Apple Python
2.5). I've also installed NumPy and SciPy for Python 2.6.

Since you are 10.5, I think your default compiler is gcc-4.0 if I'm
not very much mistaken. Can you please verify that by issuing gcc
--version?

I had a private conversation with the "owner" of the previous thread
about OS X, and it seems that there are two ways to build matplotlib.
I personally had no luck with the prebuilt version either, but I don't
remember the issue, I think it wasn't compatible with my gcc-4.2
compiled freetype2 (I'm on 10.6).

a) Use make.osx. This is quite easy, but you have no control over
where the libraries are installed, and if you do not log it via 2>&1 |
tee log.txt we will be unable to diagnose. make.osx installs
libraries in your system, so be aware of this.

b) Install the libraries on your own. This seems to be a little more
complicated, but it isn't really. I used libpng 1.4 with a few
modifications, just a few lines in src/_png.cpp. (You also may
already have recent enough versions through your /opt/ path.)

Sorry, I'm writing this again and again to all the users I tried to
convice of this way, but I didn't find inclination to do it properly
together with the developers on the website.

Did you compile Python 2.6 yourself? If yes, have you made sure to
use the --enable-framework switch for configure?

I've tried EasyInstall, svn, and dmg. The dmg expects Apple Python 2.6 so
that's out. For the EasyInstall and svn routes I think I must be missing
some external libraries? Below are some snippets of warnings/error messages:

It would be helpful to have information about the initial diagnostic
output of the setup.py call, but I don't know if easy_install works
that way. The installation routine tells there what libraries are
found and if you have pkg-config it tells also the version found.

from EasyInstall:
$ easy_install matplotlib

            matplotlib: 0.99.3
warning: no files found matching 'MANIFEST'
warning: no files found matching 'lib/mpl_toolkits'
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libpng12.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture
for architecture ppc

I think /opt/ installs are macports or similar? What kind of "package
system" for Mac do you have installed?

collect2: ld returned 1 exit status

It doesn't tell which arch it's missing. I'm a bit confused about
this "missing architecture". What arch does your system have?

ld warning: duplicate dylib /opt/local/lib/libz.1.dylib

That's strange to me.

lipo: can't open input file:
/var/folders/Yh/Yh3On1j+FXW+r-334Wk-vk+++TI/-Tmp-//ccWD9nm4.out (No such
file or directory)
error: Setup script exited with error: command 'c++' failed with exit status
1

This is the normal error when it failed.

from SVN:
$ python setup.py build
            matplotlib: 1.0.svn

Somewhere here comes the output about the libraries and dependencies.

ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture
for architecture ppc
collect2: ld returned 1 exit status
ld warning: duplicate dylib /opt/local/lib/libz.1.dylib
lipo: can't open input file:
/var/folders/Yh/Yh3On1j+FXW+r-334Wk-vk+++TI/-Tmp-//cc6cv190.out (No such
file or directory)
error: command 'c++' failed with exit status 1

This all seems the same as above.

and in both throughout the messages there are references to "linker input
file unused because linking not done" for
powerpc-apple-darwin9-gcc-4.0.1 and i686-apple-darwin9-gcc-4.0.1.

I don't know, I also encountered this often, seems to be an extra
option issued by the distutils, which is not needed.

I'd tried the EPD version also (and had it working), but then EasyInstall
would direct me to their repositories (for which I did not have a password)
so I could not download and install RPy2 and other modules (easily), so I
decided to build up from individual components...

I did without EPD and 0.99.3 is working fine.

Any advice you can provide on helping me complete the matplotlib
installation? I think after this I will have the basics for data analysis in
Python (with NumPy and SciPy).

Yeah.

Please be prepared that it may take a while to sort out all the issues
on our way. But I'm sure it's worth!

Friedrich

Hi Friedrich,

Thanks so much for your response!

Date: Wed, 7 Jul 2010 20:16:24 +0200

Since you are 10.5, I think your default compiler is gcc-4.0 if I’m
not very much mistaken. Can you please verify that by issuing gcc
–version?

I had a private conversation with the “owner” of the previous thread
about OS X, and it seems that there are two ways to build matplotlib.
I personally had no luck with the prebuilt version either, but I don’t
remember the issue, I think it wasn’t compatible with my gcc-4.2
compiled freetype2 (I’m on 10.6).

a) Use make.osx. This is quite easy, but you have no control over
where the libraries are installed, and if you do not log it via 2>&1 |
tee log.txt we will be unable to diagnose. make.osx installs
libraries in your system, so be aware of this.

b) Install the libraries on your own. This seems to be a little more
complicated, but it isn’t really. I used libpng 1.4 with a few
modifications, just a few lines in src/_png.cpp. (You also may
already have recent enough versions through your /opt/ path.)

Sorry, I’m writing this again and again to all the users I tried to
convice of this way, but I didn’t find inclination to do it properly
together with the developers on the website.

It is indeed true that I have gcc 4.0

i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)

Did you compile Python 2.6 yourself? If yes, have you made sure to
use the --enable-framework switch for configure?

I installed it using a pre-compiled binary for OS X Leopard, so I did not set any options. Perhaps I should build from source and add this option?

I’ve tried EasyInstall, svn, and dmg. The dmg expects Apple Python 2.6 so
that’s out. For the EasyInstall and svn routes I think I must be missing
some external libraries? Below are some snippets of warnings/error messages:

It would be helpful to have information about the initial diagnostic
output of the setup.py call, but I don’t know if easy_install works
that way. The installation routine tells there what libraries are
found and if you have pkg-config it tells also the version found.

from EasyInstall:
$ easy_install matplotlib

matplotlib: 0.99.3
warning: no files found matching ‘MANIFEST’
warning: no files found matching ‘lib/mpl_toolkits’
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libpng12.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture
for architecture ppc

I think /opt/ installs are macports or similar? What kind of “package
system” for Mac do you have installed?

That is true… I do have Macports installed and /opt/ is for Macports. But for Python, Numpy, and Scipy, I used the pre-compiled binaries for OS X; the matplotlib I am trying to install now is from the subversion repository. I am not sure what you mean by the initial diagnostic output (perhaps output below?), but I used make.osx and specified that zlib, png and freetype be installed in my ~/dev directory as shown in README.osx and make.osx. I also added all the paths recursively to my PATH in case it was using this variable to look for these programs, but my output error still looks like

basedirlist is:

···

============================================================================

BUILDING MATPLOTLIB

matplotlib: 1.0.svn

python: 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) [GCC

4.0.1 (Apple Inc. build 5493)]

platform: darwin

REQUIRED DEPENDENCIES

numpy: 1.4.1

freetype2: 9.20.3

OPTIONAL BACKEND DEPENDENCIES

libpng: 1.2.35

Tkinter: Tkinter: 73770, Tk: 8.4, Tcl: 8.4

wxPython: no

  • wxPython not found

Gtk+: no

  • Building for Gtk+ requires pygtk; you must be able

  • to “import gtk” in your build/install environment

Mac OS X native: yes

Qt: no

Qt4: no

Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES

datetime: present, version unknown

dateutil: matplotlib will provide

pytz: matplotlib will provide

adding pytz

OPTIONAL USETEX DEPENDENCIES

dvipng: 1.9

ghostscript: 8.64

latex: 3.141592

pdftops: 3.02

[…] and then:

ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required architecture

ld warning: in /opt/local/lib/libz.dylib, file is not of required architecture

ld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture for architecture ppc

collect2: ld returned 1 exit status

ld warning: duplicate dylib /opt/local/lib/libz.1.dylib

lipo: can’t open input file: /var/folders/Yh/Yh3On1j+FXW+r-334Wk-vk+++TI/-Tmp-//ccUX0Ard.out (No such file or directory)

error: command ‘c++’ failed with exit status 1

collect2: ld returned 1 exit status

It doesn’t tell which arch it’s missing. I’m a bit confused about
this “missing architecture”. What arch does your system have?

My architecture is an Intel Core 2 Duo 2 GHz (64-bit).

Please be prepared that it may take a while to sort out all the issues
on our way. But I’m sure it’s worth!

Sorry for my delayed response - I am currently on travel… but I hope this is fixable. If nothing else comes to mind, I will try installing Python 2.6 from source with the option you mentioned?

Thanks so much!

Stephen


The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. Get busy.

2010/7/15 Stephen T. <obsessively@...32...>:

============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.0.svn
python: 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) [GCC
4.0.1 (Apple Inc. build 5493)]
platform: darwin
REQUIRED DEPENDENCIES
numpy: 1.4.1
freetype2: 9.20.3
OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.35
Tkinter: Tkinter: 73770, Tk: 8.4, Tcl: 8.4
wxPython: no
* wxPython not found
Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
Mac OS X native: yes
Qt: no
Qt4: no
Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: matplotlib will provide
pytz: matplotlib will provide
adding pytz
OPTIONAL USETEX DEPENDENCIES
dvipng: 1.9
ghostscript: 8.64
latex: 3.141592
pdftops: 3.02

Exactly what I had in mind, and everything ok so far.

[...] and then:
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture
for architecture ppc
collect2: ld returned 1 exit status
ld warning: duplicate dylib /opt/local/lib/libz.1.dylib
lipo: can't open input file:
/var/folders/Yh/Yh3On1j+FXW+r-334Wk-vk+++TI/-Tmp-//ccUX0Ard.out (No such
file or directory)
error: command 'c++' failed with exit status 1

> collect2: ld returned 1 exit status

It doesn't tell which arch it's missing. I'm a bit confused about
this "missing architecture". What arch does your system have?

My architecture is an Intel Core 2 Duo 2 GHz (64-bit).

This is important. I recently had a similar issue (sort of). I think
the macports library is 32-bit only, and I know that at least for
building Python the build performs 64-bit only by default (this was my
issue) on a 64bit system. Of course, in case you want to make a 64bit
build against a 32bit library the error would be sensible.

To check this, try to run:
$ file /opt/local/lib/libxml2.2.dylib

When I run it on the Apple supplied file it gives:

/usr/lib/libxml2.dylib: Mach-O universal binary with 3 architectures
/usr/lib/libxml2.dylib (for architecture x86_64): Mach-O 64-bit
dynamically linked shared library x86_64
/usr/lib/libxml2.dylib (for architecture i386): Mach-O dynamically
linked shared library i386
/usr/lib/libxml2.dylib (for architecture ppc7400): Mach-O dynamically
linked shared library ppc

Maybe we can track it down that way.

Sorry for my delayed response - I am currently on travel... but I hope this
is fixable. If nothing else comes to mind, I will try installing Python 2.6
from source with the option you mentioned?

I hope you had some patience ... I was sick :frowning:

And now, as you have choosen the make.osx way, we stick to that. I'll
try to learn it ... :slight_smile:

The --enable-framework switch is only important when you want Python
to be installed in /Library/Frameworks/Python.framework . Otherwise
it will install in the normal unix path. I think the python.org
installer installs as a framework, although I'm not completely sure,
and would welcome correction if I'm wrong.

Friedrich

Hi Friedrich,

Thanks again for your response. I’ve been away traveling (with no internet connection) and just returned… hope you can help me troubleshoot this last bit (hopefully last bit)!

This is important. I recently had a similar issue (sort of). I think
the macports library is 32-bit only, and I know that at least for
building Python the build performs 64-bit only by default (this was my
issue) on a 64bit system. Of course, in case you want to make a 64bit
build against a 32bit library the error would be sensible.

To check this, try to run:
$ file /opt/local/lib/libxml2.2.dylib

When I run it on the Apple supplied file it gives:

/usr/lib/libxml2.dylib: Mach-O universal binary with 3 architectures
/usr/lib/libxml2.dylib (for architecture x86_64): Mach-O 64-bit
dynamically linked shared library x86_64
/usr/lib/libxml2.dylib (for architecture i386): Mach-O dynamically
linked shared library i386
/usr/lib/libxml2.dylib (for architecture ppc7400): Mach-O dynamically
linked shared library ppc

mine gives only:

/opt/local/lib/libxml2.2.dylib: Mach-O dynamically linked shared library i386

Is this the problem?

Thanks so much!

Stephen

Hi Friedrich,

Thanks for your help. Just thought I would follow up to say that it appears to be working now. I am not sure what was different this time and last - my libxml file still points to the one with the architecture shown below, but I had come across this post about changing the targeted architecture called for gcc manually:

http://passingcuriosity.com/2009/installing-pil-on-mac-os-x-leopard/

So I had in mind to try this with the matplotlib installation, but for some reason the make command did not fail in error this time… as before, I had typed in my bash shell:

export PREFIX=~/dev

make -f make.osx fetch deps mpl_install

and I am not sure why but those previous error messages never came up. So in the end I just included the new matplotlib directory in my python path (in .bash_profile):

export PYTHONPATH:~/dev/lib/python2.6/site-packages:$PYTHONPATH

and it appears to be working ok.

So sorry for all the trouble, but thanks for your time!

All the best,

Stephen

···

From: obsessively@…32…
To: friedrichromstedt@…287…
CC: matplotlib-users@lists.sourceforge.net
Subject: RE: [Matplotlib-users] installation of matplotlib on OS X 10.5 with python.org Python 2.6
Date: Fri, 6 Aug 2010 13:06:20 -0700

Hi Friedrich,

Thanks again for your response. I’ve been away traveling (with no internet connection) and just returned… hope you can help me troubleshoot this last bit (hopefully last bit)!

This is important. I recently had a similar issue (sort of). I think
the macports library is 32-bit only, and I know that at least for
building Python the build performs 64-bit only by default (this was my
issue) on a 64bit system. Of course, in case you want to make a 64bit
build against a 32bit library the error would be sensible.

To check this, try to run:
$ file /opt/local/lib/libxml2.2.dylib

When I run it on the Apple supplied file it gives:

/usr/lib/libxml2.dylib: Mach-O universal binary with 3 architectures
/usr/lib/libxml2.dylib (for architecture x86_64): Mach-O 64-bit
dynamically linked shared library x86_64
/usr/lib/libxml2.dylib (for architecture i386): Mach-O dynamically
linked shared library i386
/usr/lib/libxml2.dylib (for architecture ppc7400): Mach-O dynamically
linked shared library ppc

mine gives only:

/opt/local/lib/libxml2.2.dylib: Mach-O dynamically linked shared library i386

Is this the problem?

Thanks so much!

Stephen

2010/8/17 Stephen T. <obsessively@...32...>:

Installing the Python Imaging Library on Mac OS X Leopard - Passing Curiosity

That's a good thing to know when people run into /opt/ trouble of this
kind ... Thanks

So I had in mind to try this with the matplotlib installation, but for some
reason the make command did not fail in error this time... as before, I had
typed in my bash shell:
export PREFIX=~/dev
make -f make.osx fetch deps mpl_install
and I am not sure why but those previous error messages never came up. So in
the end I just included the new matplotlib directory in my python path (in
.bash_profile):
export PYTHONPATH:~/dev/lib/python2.6/site-packages:$PYTHONPATH

You surely mean export PYTHONPATH= ... (with an equality sign)?

and it appears to be working ok.

*sigh* mysteries of Mac OS X compilations ...

Am I right with guessing that you do not want to dig into this?

Friedrich