Dear matplotlib-users, I would appreciate some help installing matplotlib on fedora core 3. After an initial unsuccessful build using gtk I decided to try to avoid the pygtk 2.4 problem http://matplotlib.sourceforge.net/faq.html#PYGTK24 I therefore changed two lines in setup.py so that it now reads BUILD_GTKAGG = 0 #BUILD_GTKAGG = 'auto' #BUILD_GTK = 'auto' BUILD_GTK = 0 After that the build and install went smoothly. But now if I try to import pylab I get the following error: >>> import pylab Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.3/site-packages/pylab.py", line 1, in ? from matplotlib.pylab import * File "/usr/lib/python2.3/site-packages/matplotlib/pylab.py", line 196, in ? import backends File "/usr/lib/python2.3/site- packages/matplotlib/backends/__init__.py", line 19, in ? globals(),locals(),[backend_name]) File "/usr/lib/python2.3/site- packages/matplotlib/backends/backend_gtkagg.py", line 10, in ? from backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/usr/lib/python2.3/site- packages/matplotlib/backends/backend_gtk.py", line 20, in ? from backend_gdk import RendererGDK File "/usr/lib/python2.3/site- packages/matplotlib/backends/backend_gdk.py", line 44, in ? from matplotlib._nc_backend_gdk import pixbuf_get_pixels_array ImportError: No module named _nc_backend_gdk >>> As far as I can see it is still trying to use some gtk-stuff? I have tried removing the site-packages/matplotlib directory completely and also do a new build and install from a fresh tarball with only the above mentioned two changes in setup.py, but still I get the error. Any help would be appreciated. Karsten.
>>>>> "Karsten" == Karsten Wedel Jacobsen <kw...@fy...> writes: Karsten> After that the build and install went smoothly. But now Karsten> if I try to import pylab I get the following error: Karsten> pixbuf_get_pixels_array ImportError: No module named Karsten> _nc_backend_gdk Karsten> As far as I can see it is still trying to use some Karsten> gtk-stuff? This is a bit of annoyance in the mpl setup. The backend that is chosen at runtime is determined by the rc file (see http://matplotlib.sf.net/.matplotlibrc) and the default backend in the rc file is GTKAgg. Even if you turn GTK compilation off in setup.py, the rc file still determines which backend is selected. You need to copy that file from its default location (eg /usr/share/matplotlib/.matplotlibrc) to your HOME directory and edit the 'backend' setting to something else, eg TkAgg, WXAgg or QtAgg. While debugging, it is helpful to create a simple script like import pylab pylab.plot([1,2,3]) pylab.show() and run it with > python myscript.py --verbose-helpful which will show you which rc file is being loaded, which backend is selected, what mpl version you are using, and so on. Should help, JDH PS: the bug in pygtk2.4 in fedora core 3 is quite ease to fix. You simply have to replace typename with another name like typename_ or some other name as described in the FAQ.
Dear John, Thanks for the help. Now it works! Karsten. On Tue, 2005年04月26日 at 20:38 -0500, John Hunter wrote: > >>>>> "Karsten" == Karsten Wedel Jacobsen <kw...@fy...> writes: > > Karsten> After that the build and install went smoothly. But now > Karsten> if I try to import pylab I get the following error: > Karsten> pixbuf_get_pixels_array ImportError: No module named > Karsten> _nc_backend_gdk > > Karsten> As far as I can see it is still trying to use some > Karsten> gtk-stuff? > > This is a bit of annoyance in the mpl setup. The backend that is > chosen at runtime is determined by the rc file (see > http://matplotlib.sf.net/.matplotlibrc) and the default backend in the > rc file is GTKAgg. Even if you turn GTK compilation off in setup.py, > the rc file still determines which backend is selected. You need to > copy that file from its default location (eg > /usr/share/matplotlib/.matplotlibrc) to your HOME directory and edit > the 'backend' setting to something else, eg TkAgg, WXAgg or QtAgg. > > While debugging, it is helpful to create a simple script like > > import pylab > pylab.plot([1,2,3]) > pylab.show() > > and run it with > > > python myscript.py --verbose-helpful > > which will show you which rc file is being loaded, which backend is > selected, what mpl version you are using, and so on. > > > Should help, > JDH > > PS: the bug in pygtk2.4 in fedora core 3 is quite ease to fix. You > simply have to replace typename with another name like typename_ or > some other name as described in the FAQ.