I corrected the problem with the FreeType2 header file and rebuilt matplotlib from scratch, but I'm getting the same error.  Centos5 puts the file ft2build.h in /usr/lib but matplotlib looks for it in /usr/lib/freetype2.  I used this command:
PKG_CONFIG_PATH=/home/cfinch/lib/pkgconfig  python2.7 setup.py build &> build_log.txt
and got this output:

basedirlist is: ['/home/cfinch']
============================================================================
BUILDING MATPLOTLIB
            matplotlib: 1.0.1
                python: 2.7.2 (default, Aug 30 2011, 12:57:00)  [GCC 4.1.2
                        20080704 (Red Hat 4.1.2-50)]
              platform: linux2

REQUIRED DEPENDENCIES
                 numpy: 1.6.1
             freetype2: 9.10.3

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.2.10
               Tkinter: no
                        * TKAgg requires Tkinter
              wxPython: no
                        * wxPython not found
                  Gtk+: gtk+: 2.10.4, glib: 2.12.3, pygtk: 2.10.6,
                        pygobject: 2.14.2
       Mac OS X native: no
                    Qt: no
                   Qt4: no
                 Cairo: 1.2.2

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: 1.5
                  pytz: 2010o

OPTIONAL USETEX DEPENDENCIES
                dvipng: 1.5
           ghostscript: 8.70
                 latex: 3.141592
               pdftops: 3.00

[Edit setup.cfg to suppress the above messages]
============================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.tri', 'matplotlib.delaunay']
running install
running build
running build_py
...

There are no errors in the rest of the build or install logs.  Further, I rebuild pycairo, pygtk, and matplotlib just to make sure one of them wasn't missing a freetype dependency.  Unfortunately, I am still getting exactly the same error as before.  Any other suggestions?

   Craig


From: Eric Firing <efiring@hawaii.edu>
To: matplotlib-users@lists.sourceforge.net
Sent: Tuesday, August 30, 2011 6:19 PM
Subject: Re: [Matplotlib-users] Problem with GTK backends after compiling matplotlib

On 08/30/2011 12:14 PM, Craig Finch wrote:
> I successfully built Python 2.7.2, NumPy 1.61, and Scipy 0.9.0 in my
> home directory on a Centos5 system. I am trying to build matplotlib
> 1.0.1 in my home directory, but I am having a problem with the GTK
> backends. I also built pycairo 1.2.2, pygobject 2.14.2, and pygtk 2.10.6
> in my home directory (using the libraries and headers installed in the
> default system locations). I downloaded a few pygtk examples from the
> tutorial section of their web site and ran them to verify that pygtk
> works correctly.
>
> Here is the error I get when I run a script that contains only the line
> "import matplotlib.pyplot":
>
> python2.7 test.py --verbose-helpful
> $HOME=/home/cfinch
> CONFIGDIR=/home/cfinch/.matplotlib
> matplotlib data path
> /home/cfinch/.local/lib/python2.7/site-packages/matplotlib/mpl-data
> loaded rc file
> /home/cfinch/.local/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
> matplotlib version 1.0.1
> verbose.level helpful
> interactive is False
> units is False
> platform is linux2
> Using fontManager instance from /home/cfinch/.matplotlib/fontList.cache
> Traceback (most recent call last):
> File "test.py", line 1, in <module>
> import matplotlib.pyplot
> File
> "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/pyplot.py",
> line 95, in <module>
> new_figure_manager, draw_if_interactive, show = pylab_setup()
> File
> "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/__init__.py",
> line 25, in pylab_setup
> globals(),locals(),[backend_name])
> File
> "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py",
> line 10, in <module>
> from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
> FigureCanvasGTK,\
> File
> "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py",
> line 28, in <module>
> from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
> File
> "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gdk.py",
> line 29, in <module>
> from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
> ImportError: No module named _backend_gdk
>
> Here is the beginning of my matplotlib build log, which shows that the
> build process is actually finding the GTK libraries:
>
> basedirlist is: ['/home/cfinch']
> ============================================================================
> BUILDING MATPLOTLIB
> matplotlib: 1.0.1
> python: 2.7.2 (default, Aug 30 2011, 12:57:00) [GCC 4.1.2
> 20080704 (Red Hat 4.1.2-50)]
> platform: linux2
>
> REQUIRED DEPENDENCIES
> numpy: 1.6.1
> freetype2: 9.10.3
> * WARNING: Could not find 'freetype2' headers in any
> * of '/home/cfinch/include', '.',
> * '/usr/include/freetype2'.

Freetype is a requirement, so my guess is that this is the origin of the
problem, even though it is is showing up as a puzzling import error for
_backend_gdk.

Eric


>
> OPTIONAL BACKEND DEPENDENCIES
> libpng: 1.2.10
> Tkinter: no
> * TKAgg requires Tkinter
> wxPython: no
> * wxPython not found
> Gtk+: gtk+: 2.10.4, glib: 2.12.3, pygtk: 2.10.6,
> pygobject: 2.14.2
> Mac OS X native: no
> Qt: no
> Qt4: no
> Cairo: 1.2.2
>
> OPTIONAL DATE/TIMEZONE DEPENDENCIES
> datetime: present, version unknown
> dateutil: 1.5
> pytz: 2010o
>
> OPTIONAL USETEX DEPENDENCIES
> dvipng: 1.5
> ghostscript: 8.70
> latex: 3.141592
> pdftops: 3.00
> ------------ SNIP -----------
>
> There are no errors in the build or install logs, but I can post the
> rest of it if necessary. Also, the library _backend_gdk.so is present in
> ~/lib/python2.7/site-packages/matplotlib/backends/.
>
> Any suggestions would be appreciated!
>

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users