From: David B. <db...@ya...> - 2004-04-01 00:43:30
|
I installed the matplotlib-1.52.win32-py2.3 binary on python23 (Enthought). I don't want to install a lot of extra packages so I found the existing .matplotlibrc in C:\Python23\share\matplotlib and modified the backend to "backend : TkAgg". But when I try to import matplotlib it appears to be still looking for the default Gtk backend. I noticed that sys.path did not contain C:\Python23\share\matplotlib so I tried adding it. Still no luck. Here's the error message: IDLE 1.0 ==== No Subprocess ==== >>> from matplotlib.matlab import * No module named pygtk matplotlib requires pygtk-1.99.16 or greater -- trying anyway. Please hold on Traceback (most recent call last): File "<pyshell#0>", line 1, in ? from matplotlib.matlab import * File "C:\Python23\Lib\site-packages\matplotlib\matlab.py", line 127, in ? from backends import new_figure_manager, error_msg, \ File "C:\Python23\Lib\site-packages\matplotlib\backends\__init__.py", line 16, in ? from backend_gtk import \ File "C:\Python23\Lib\site-packages\matplotlib\backends\backend_gtk.py", line 13, in ? import gobject ImportError: No module named gobject >>> Any ideas on why this does not work? Should my python path contain the path to share\matplotlib ? -- David __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html |
From: John H. <jdh...@ac...> - 2004-04-01 02:04:13
|
>>>>> "David" == David Brown <db...@ya...> writes: David> I installed the matplotlib-1.52.win32-py2.3 binary on David> python23 (Enthought). I don't want to install a lot of David> extra packages so I found the existing .matplotlibrc in David> C:\Python23\share\matplotlib and modified the backend to David> "backend : TkAgg". But when I try to import matplotlib it David> appears to be still looking for the default Gtk backend. David> I noticed that sys.path did not contain David> C:\Python23\share\matplotlib so I tried adding it. Still David> no luck. It has nothing to do with sys.path, so you can safely ignore this. David> Here's the error message: David> IDLE 1.0 ==== No Subprocess ==== ^^^ Ahh the golden piece of information. Todd Miller has reported that idle does not seem to respect matplotlibrc. At this point we have no idea why. We'll try to get this figured out ASAP! As a test case, try to run a matplotlib script from the DOS prompt C:> python somefile.py and see if TkAgg launches. If so, we can be fairly sure it's idle. Probably just double clicking on one of the examples from the zip distribution will be enough, but you lose the traceback this way if there is an error. Let me know, JDH |
From: John H. <jdh...@ac...> - 2004-04-01 14:17:45
|
>>>>> "John" == John Hunter <jdh...@ac...> writes: John> Ahh the golden piece of information. Todd Miller has John> reported that idle does not seem to respect matplotlibrc. John> At this point we have no idea why. We'll try to get this John> figured out ASAP! I found one problem. IDLE sets the HOME variable, and there is a bug in the way matplotlib located the rc file. Basically, if HOME is set, it expects the rc file to be there. Here is a fix. Edit C:\Python23\Lib\site-packages\matplotlib\__init__.py and replace the function matplotlib_fname with the following def matplotlib_fname(): 'Return the path to the rc file' if os.environ.has_key('MATPLOTLIBRC'): path = os.environ['MATPLOTLIBRC'] if os.path.exists(path): fname = os.path.join(path, '.matplotlibrc') if os.path.exists(fname): return fname if os.environ.has_key('HOME'): path = os.environ['HOME'] if os.path.exists(path): fname = os.path.join(path, '.matplotlibrc') if os.path.exists(fname): return fname path = get_data_path() # guaranteed to exist or raise fname = os.path.join(path, '.matplotlibrc') if not os.path.exists(fname): print >> sys.stderr, 'Could not find .matplotlibrc; using defaults' return fname I tested this on windows with idle. Idle now respects matplotlibrc and loads TkAgg. However, at least on my system, there is still some idle bug because the Tk window launches and then freezes without displaying the figure I suspect Todd, the TkAgg author, will be looking at this soon. [Todd, I had this problem with or without window_focus set in my test]. Sorry for the troubles, JDH |
From: Todd M. <jm...@st...> - 2004-04-01 15:07:55
|
On Thu, 2004-04-01 at 08:55, John Hunter wrote: > >>>>> "John" == John Hunter <jdh...@ac...> writes: > I tested this on windows with idle. Idle now respects matplotlibrc > and loads TkAgg. However, at least on my system, there is still some > idle bug because the Tk window launches and then freezes without > displaying the figure I suspect Todd, the TkAgg author, will be > looking at this soon. [Todd, I had this problem with or without > window_focus set in my test]. I googled around on this and got a suggestion having to do with mainloop handling from an old Guido e-mail. IDLE has a -n switch which you can add to the end of the windows shortcut command line (Target:) under the shortcut properties. When I did this, matplotlib is unfrozen. The e-mail is a little ominous about using the switch: I think a failure in matplotlib could also bring down IDLE and any open windows it might have lying around (like, say, a plot script!). Guido also suggests that running the matplotlib Tkinter mainloop in its own thread to avoid using -n is a bad idea. This is looking dicey. We might want to make a note that using IDLE with -n can be done but is considered risky. Here's Guido: http://aspn.activestate.com/ASPN/Mail/Message/edu-sig/1818398 Regards, Todd -- Todd Miller <jm...@st...> |