I'm trying to include Matplotlib plots in a Python app I'm developing with Anjuta (updated Ubuntu 12.04, 64-bit). In a tutorial, I have to import "backends", i.e.
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
And an error message is returned.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module>
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk.py", line 28, in <module>
from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
File "/usr/local/lib/python2.7/dist-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
I have search the web and the all answers converge to the following solution: "to locate your pygtk-2.0.pc file and then add that path to your PKG_CONFIG_PATH".
http://matplotlib.1069221.n5.nabble....html#a26514059
I found out that the pygtk-2.0.pc file is included in the package python-gtk2-dev, so I installed the latter. Then, I ran:
export PKG_CONFIG_PATH=/usr/lib/pkgconfig/python2.7/pygtk-2.0.pc
The problem persisted. I reinstalled matplotlib, python-gtk2 and numpy, but the error is still there. Is this a bug? Any idea how to correct this?
Bookmarks