[SciPy-user] matplotlib: pylab doesn't import (backends problem)

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Oct 6 08:56:34 CDT 2006

>>>>> "William" == William Hunter <willemjagter at gmail.com> writes:

    William> These are installed: scipy.__version__ = '0.5.1'
    William> numpy.__version__ = '1.0rc1' matplotlib.__version__ =
    William> '0.87.6'

    William> My options in setup.py for matplotlib is set to build Agg
    William> and GTKAgg ( = 1), the others all = 0. If I leave them at
    William> 'auto' as per default, matplotlib doesn't build (?). I
    William> use Ubuntu Dapper - AMD64.

    William> Here's what happens if I try to import pylab (in a new
    William> terminal):

    William> /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gdk.py
    William> 33 from matplotlib.backends._nc_backend_gdk import
    William> pixbuf_get_pixels_array 34 else:
    ---> 35 from matplotlib.backends._ns_backend_gdk import
    William> pixbuf_get_pixels_array 36 37

    William> ImportError: No module named _ns_backend_gdk

This question is better addressed on matplotlib-users....

It looks like either you do not have numpy or pygtk properly
installed.  Note also you need to eh gtk-devel packages to compile the
gtk extensions, as described at


As a quick check for numpy and pygtk, you can do

>>> import numpy
>>> import gtk

but you'll still need the gtk-devel packages

If it still doesn't work, 

> rm -rf build
> python setup.py build >& build.out

and post output to the matplotlib-devel list.


More information about the SciPy-user mailing list