_backend_gdk not found

Hi,

I'm new with matplotlib and
I'm trying to embed matplotlib objects into pygtk.

I tried different backend imports (GTKAgg, GTK, GTKCairo) and always get the same error (attached below) referring to the missing _backend_gdk package.

I work with MAC os x 10.6, python 2.6, pygtk2, matplotlib 0.99.1.1, all installed via macports , even though I tried to install matplotlib from source via the setup.py script and I get exactely the same problem.

Could you help?

Many thans in advance,
Federico

···

---------------------------------------------------------------------------
ImportError Traceback (most recent call last)

/Volumes/froncaro/LINAC4/SOURCE/python/maplotlib_test.py in <module>()
       9 #from matplotlib.backends.backend_gtk import FigureCanvasGTK, NavigationToolbar

      10
---> 11 from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas
      12
      13

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_gtkcairo.py in <module>()
       8
       9 from matplotlib.backends import backend_cairo
---> 10 from matplotlib.backends.backend_gtk import *
      11
      12 backend_version = 'PyGTK(%d.%d.%d) ' % gtk.pygtk_version + \

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py in <module>()
      23 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
      24 FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors
---> 25 from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
      26 from matplotlib.cbook import is_string_like, is_writable_file_like
      27 from matplotlib.colors import colorConverter

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_gdk.py in <module>()
      27 from matplotlib.mathtext import MathTextParser
      28 from matplotlib.transforms import Affine2D
---> 29 from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
      30
      31

ImportError: No module named _backend_gdk

matplotlib is probably not finding pygtk at build time -- you need
have pkg-config installed, and locate your pygtk-2.0.pc file and then
add that path to your PKG_CONFIG_PATH. You can check the output of
the build script at the beginning in the section

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.2.27
               Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4
              wxPython: 2.8.8.0
                        * WxAgg extension not required for wxPython >= 2.8
                  Gtk+: gtk+: 2.14.4, glib: 2.18.2, pygtk: 2.13.0,
                        pygobject: 2.15.3
       Mac OS X native: no
                    Qt: Qt: 3.3.8, PyQt: 3.17.4
                   Qt4: Qt: 4.4.3, PyQt4: 4.4.4
                 Cairo: 1.4.12

You need to have an entry for Gtk or else the backend will not be built.

JDH

···

On Wed, Nov 25, 2009 at 8:01 AM, federico roncarolo <Federico.Roncarolo@...1758...> wrote:

Hi,

I'm new with matplotlib and
I'm trying to embed matplotlib objects into pygtk.

I tried different backend imports (GTKAgg, GTK, GTKCairo) and always
get the same error (attached below) referring to the missing
_backend_gdk package.

I work with MAC os x 10.6, python 2.6, pygtk2, matplotlib 0.99.1.1,
all installed via macports , even though I tried to install matplotlib
from source via the setup.py script and I get exactely the same problem.

Could you help?