GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Aug 24, 2016 11:59 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: ImportError when I import FigureCanvasGTKAgg—seeking advice!
PostPosted: Sun Jun 05, 2011 9:54 pm 

Joined: Sun Jun 05, 2011 8:46 pm
Posts: 2
Hi all,

I am new to the forum and to all things GTK, so go easy on me, please.

A colleague created a Python program that uses matplotlib and GTK. I wanted to be able run her program on my MacBook (OS X 10.6.7). I used macports to update/obtain Python 2.7, matplotlib 1.0.1, and PyGTK 2.22.0. (I also obtained ipython, if anyone cares.)

After all of this, my colleague's program hits a snag when I try to run it; here is the traceback:
Traceback (most recent call last):
  File "", line 5, in <module>
    from interface import Interface, Display, Controls
  File "/Users/thecommexokid/Documents/CurrentProjects/Honors/DoubleSlit/", line 5, in <module>
    from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/", line 10, in <module>
    from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/", line 28, in <module>
    from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/", line 29, in <module>
    from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _backend_gdk

Any advice anyone has on how to overcome this problem and get her program running on my machine would be greatly appreciated. As I said, I am new to these things, and I don't really understand the interplay between Python, PyGTK, and matplotlib, so if there's crucial information I haven't provided, or if this isn't the best forum in which to be asking this question, let me know. Thanks in advance for the help.


EDIT: As I said, I wasn't sure what the best forum would be to post this question. I decided after I posted here that maybe the matplotlib forum made more sense, so I cross-posted over there (thread: [url]—seeking-advice%21-td31779648.html[/url]). I'll be sure to keep both threads updated with any developments.

 Post subject: Re: ImportError when I import FigureCanvasGTKAgg—seeking adv
PostPosted: Mon Jun 06, 2011 6:02 pm 

Joined: Sun Jun 05, 2011 8:46 pm
Posts: 2
I found a solution after all, in this post on the matplotlib forums:

Just as the answerer there suggested, I had PyGTK but matplotlib wasn't recognizing it during build; when I tried building from source instead of using macports this was made clear in the build output.

As he said, I searched my computer to find a file called pygtk-2.0.pc, and added the directory it was in to the system variable PKG_CONFIG_PATH. After I did that, the build was successful and I had no further problems!

Thanks to everyone who may have read my post, but I would up figuring this one out on my own.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group