Generating Pie Charts with Python under OS X
Posted by Graham Stratton Wed, 22 Nov 2006 21:54:00 GMT
It sounded like a trivial task: find a library which will produce pie charts for use on the web which has a python interface. Then install it and use it.
Well, it’s taken me most of a day, and I haven’t got there yet. There are a number of small tools which might do the job, but none of them looked quite right, so I thought I’d go the whole way and install matplotlib, which builds on scipy.
I thought I’d see whether these packages were available from the cheese shop. I think they all are, but the install of scipy failed. The first problem was that scientific stuff is written in fortran, so I had to install (from source, no darwinport) gfortran, the GNU F77 compiler.
Numpy installed fine, but scipy required fftw (which also had to be compiled from source, and some other things.
Compilation then stalled with:
/usr/bin/ld: can’t locate file for: -ldfftpack
which was solved by running
python setup.py build_clib
which creates libdfftpack.a, before continuing before the standard build. Poor dependency handling between numpy.distutils commands is apparently to blame.
Then I ran the scipy tests and some of them failed. There’s a point where it says it would use the Atlas libraries if they were available. I spent a while trying to get them to install, but failed.
I moved on to attempting to install matplotlib. I found a suitable egg, and tried to easy_install it. A linking error for libpng.
sudo port install libpng
didn’t produce an error, but didn’t fix things. Compiling from source manually did. Then I got errors about not being able to find libfreetype. I though a sym-link to the library deep in /Developer/SDKs/MacOSX10.4u.sdk/ would do the trick, but it wasn’t enough. So I depaired, and returned to Google.
I found some pre-built packages for OS X, but they used the system python 2.4, where I was happy with my compiled version, and didn’t want a new one, and figured that installing a new system python would confuse things.
Darwinports also contained a port of matplotlib, so I thought that I would try that. That also insisted on installing its own python, but I was despairing, so I tried it. The full install succeeded, but
import pylab
yielded
ImportError: No module named wx
For some reason I concluded that this was more than the simple dependency problem it appears to be, and decided to try to pre-built packages instead. They installed successfully, I just need to work out how to run the python interpreter I want.
The new system python is at /usr/bin/python – but none of the tons of stuff I had already installed is available. So I’m not sure that I’ve gained anything. Especially since
import pylab
now yields
ImportError: No module named numpy
and fixing that returns me to
No module named wx
Installing the wx binaries left me with a working import. Inspired by this, I installed the darwinports binaries with
sudo port install py-wxpython
I’m hoping this will solve my problems!
But no. Now I’ve even got two terminals which report the same path for ‘which python’, but actually start different versions of the interpreter.
In summary, it’s all a mess, and I ought to learn a bit more about how compiled languages work (in particular, how the linker looks for libraries). I’m going to have to install this on a debian system too at some point. I’m anticipating it being rather more trivial.

You mighy try open flash chart. http://free-wiz.blogspot.com/2008/07/best-free-chart-apis.html
(I realized your post is really old!)
2008-08-26 23:30