Re: [Matplotlib-users] error: Gtk* backend requires pygtk to be installed
Hi, > Went looking on examples page and found there was a file name demo_image.py > http://matplotlib.sourceforge.net/examples/axes_grid/demo_image.html > > However for whatever reason the source code was not downloadable (404 > error), so I copied it off the html page. I'm not sure why the matplotlib examples page would contain weird dependencies like that, rather than just having simpler examples. As for 'pip', it is a replacement for 'easy_install', both of which find and install python packages. pip is meant to improve on easy_install, with new features and more stability. And I think you figured out my exact problem: > I'd be questioning your configuration of matplotlib, there should be a rc > file somewhere, maybe you (or your distro) have set the backend to gtk by > default? Yep, unfortunately in ~/.matplotlib/matplotlibrc this line was set to backend : GTKAgg So I fixed that. The other solution I found is to have at the top of the plotting script the matplotlib.use() statement so that it uses something else for a backend: import matplotlib # Do this before importing pylab or pyplot #matplotlib.use('Agg') # Anti-Grain Geometry (raster images) matplotlib.use('PDF') import matplotlib.pyplot as plt Thanks! Mike -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] error: Gtk* backend requires pygtk to be installed
Hi Mike, I tried to run it on windows. Got error D:\download\python>demo_axes_grid.py Traceback (most recent call last): File "D:\download\python\demo_axes_grid.py", line 2, in from demo_image import get_demo_image ImportError: No module named demo_image Went looking on examples page and found there was a file name demo_image.py http://matplotlib.sourceforge.net/examples/axes_grid/demo_image.html However for whatever reason the source code was not downloadable (404 error), so I copied it off the html page. After that the example ran fine under windows, ... I have never installed anything called 'dsextras' and don't know what it is. However it doesn't look like a gtk GUI to me., a quick check of the code reveals no gtk type commands or imports? I'd be questioning your configuration of matplotlib, there should be a rc file somewhere, maybe you (or your distro) have set the backend to gtk by default? I don't have a system here without gtk installed, that I could test example runs without it installed - sorry. (what distro and what's a pip command?) - Steve On 23/06/2010 11:09 PM, Mike Anderson wrote: Hi, I'm trying to run a demo example, http://matplotlib.sourceforge.net/plot_directive/mpl_toolkits/axes_grid/figures/demo_axes_grid.py ran into this problem saying pygtk was needed: $ curl http://matplotlib.sourceforge.net/plot_directive/mpl_toolkits/axes_grid/figures/demo_axes_grid.py > demo_axes_grid.py $ python demo_axes_grid.py Traceback (most recent call last): File "demo_axes_grid.py", line 1, in import matplotlib.pyplot as plt File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/pyplot.py", line 78, in new_figure_manager, draw_if_interactive, show = pylab_setup() File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 11, in raise ImportError("Gtk* backend requires pygtk to be installed.") ImportError: Gtk* backend requires pygtk to be installed. Then I tried to install pygtk: $ pip install pygtk Downloading/unpacking pygtk Running setup.py egg_info for package pygtk Traceback (most recent call last): File "", line 14, in File "/Users/michaelanderson/root/mikeWork/2010June/temp/build/pygtk/setup.py", line 22, in from dsextras import get_m4_define, getoutput, have_pkgconfig, \ ImportError: No module named dsextras Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 14, in File "/Users/michaelanderson/root/mikeWork/2010June/temp/build/pygtk/setup.py", line 22, in from dsextras import get_m4_define, getoutput, have_pkgconfig, \ ImportError: No module named dsextras Command python setup.py egg_info failed with error code 1 Storing complete log in /Users/michaelanderson/.pip/pip.log Ok, then I tried to install dsextras: $ pip install dsextras Downloading/unpacking dsextras Could not find any downloads that satisfy the requirement dsextras No distributions at all found for dsextras Storing complete log in /Users/michaelanderson/.pip/pip.log What is this obscure package (dsextras) and is it really necessary to run the shared axes demo? Mike -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] error: Gtk* backend requires pygtk to be installed
Hi, I'm trying to run a demo example, http://matplotlib.sourceforge.net/plot_directive/mpl_toolkits/axes_grid/figures/demo_axes_grid.py ran into this problem saying pygtk was needed: $ curl http://matplotlib.sourceforge.net/plot_directive/mpl_toolkits/axes_grid/figures/demo_axes_grid.py> demo_axes_grid.py $ python demo_axes_grid.py Traceback (most recent call last): File "demo_axes_grid.py", line 1, in import matplotlib.pyplot as plt File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/pyplot.py", line 78, in new_figure_manager, draw_if_interactive, show = pylab_setup() File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 11, in raise ImportError("Gtk* backend requires pygtk to be installed.") ImportError: Gtk* backend requires pygtk to be installed. Then I tried to install pygtk: $ pip install pygtk Downloading/unpacking pygtk Running setup.py egg_info for package pygtk Traceback (most recent call last): File "", line 14, in File "/Users/michaelanderson/root/mikeWork/2010June/temp/build/pygtk/setup.py", line 22, in from dsextras import get_m4_define, getoutput, have_pkgconfig, \ ImportError: No module named dsextras Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 14, in File "/Users/michaelanderson/root/mikeWork/2010June/temp/build/pygtk/setup.py", line 22, in from dsextras import get_m4_define, getoutput, have_pkgconfig, \ ImportError: No module named dsextras Command python setup.py egg_info failed with error code 1 Storing complete log in /Users/michaelanderson/.pip/pip.log Ok, then I tried to install dsextras: $ pip install dsextras Downloading/unpacking dsextras Could not find any downloads that satisfy the requirement dsextras No distributions at all found for dsextras Storing complete log in /Users/michaelanderson/.pip/pip.log What is this obscure package (dsextras) and is it really necessary to run the shared axes demo? Mike -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users