You need to set a different backend in your matplotlibrc or specify it first.

import matplotlib
matplotlib.use('Agg')

You can also run scripts passing the backend:

python lab1_ex2.py -dAgg

On Jan 9, 2008 8:41 AM, Francesco Pretto <[EMAIL PROTECTED]> wrote:
> Hi, after having correctly compiled matplotlib, now is time to test
> something (I need at least to get it something working before I can
> start hack it autonomously =). Unfortunately, it's not usable: it
> complains about not being able to load "_tkagg" module. The fact is I
> don't want "tkagg" backend at all! Here is the backends dependencies
> detect log:
>
> OPTIONAL BACKEND DEPENDENCIES
>                 libpng: found, but unknown version (no pkg-config)
>                Tkinter: no
>                         * Tkinter present, but header files are not found.
>                         * You may need to install development packages.
>               wxPython: no
>                         * wxPython not found
>                   Gtk+: gtk+: 2.10.11, glib: 2.12.11, pygtk: 2.10.6,
>                         pygobject: 2.12.3
>                     Qt: no
>                    Qt4: no
>                  Cairo: 1.2.6
>
> As it should be clear, I want to use the a gtk+ aware backend, and
> initially in fact I used a customized "setup.cfg"; seeing the error I
> tryed deleting the customized "setup.cfg", but without results. Is
> there some problems with backend selection on windows platform?
> I hope gtk+ backends are supported. Follows 2 traces of the error
> running an ipython shell and a test python program (it works on
> linux).
>
> Any help is appreciated.
>
> Thanks,
> Francesco
>
> ---------------------------------------------------------------------------
>
> Here is the trace in ipython trying to run sample test program:
>
> In [3]: run lab1_ex2.py
>
> ImportError                               Traceback (most recent call last)
>
> C:\Documents and Settings\Public\desktop\lab1_ex2.py in <module>()
>       1 from numpy import *
>       2 from scipy import *
> ----> 3 from pylab import *
>       4
>       5 n=100
>
> c:\python25\Lib\site-packages\pylab.py in <module>()
> ----> 1
>       2
>       3 from matplotlib.pylab import *
>       4 import matplotlib.pylab
>       5 __doc__ = matplotlib.pylab.__doc__
>
> c:\python25\Lib\site-packages\matplotlib\pylab.py in <module>()
>     290
>     291
> --> 292 from matplotlib.pyplot import *
>     293
>     294
>
> c:\python25\Lib\site-packages\matplotlib\pyplot.py in <module>()
>      35
>      36 from matplotlib.backends import pylab_setup
> ---> 37 new_figure_manager, draw_if_interactive, show = pylab_setup()
>      38
>      39 def switch_backend(newbackend):
>
> c:\python25\Lib\site-packages\matplotlib\backends\__init__.py in pylab_setup()
>      22     backend_name = 'backend_'+backend.lower()
>      23     backend_mod = __import__('matplotlib.backends.'+backend_name,
> ---> 24                              globals(),locals(),[backend_name])
>      25
>      26     # Things we pull in from all backends
>
> c:\python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py in 
> <module>()
>
>       6
>       7 import Tkinter as Tk, FileDialog
> ----> 8 import tkagg                 # Paint image to Tk photo blitter 
> extension
>
>       9 from backend_agg import FigureCanvasAgg
>      10
>
> c:\python25\Lib\site-packages\matplotlib\backends\tkagg.py in <module>()
> ----> 1
>       2
>       3 import _tkagg
>       4 import Tkinter as Tk
>       5
>       6 def blit(photoimage, aggimage, bbox=None, colormode=1):
>       7     tk = photoimage.tk
>
> ImportError: No module named _tkagg
> WARNING: Failure executing file: <lab1_ex2.py>
>
> ---------------------------------------------------------------------------
>
> Here is another trace trying to run ipython with "--pylab" switch:
>
> Traceback (most recent call last):
>   File "C:\Python25\scripts\ipython", line 27, in <module>
>     IPython.Shell.start().mainloop()
>   File "C:\Python25\lib\site-packages\IPython\Shell.py", line 1152, in start
>     return shell(user_ns = user_ns)
>   File "C:\Python25\lib\site-packages\IPython\Shell.py", line 1049, in 
> __init__
>     shell_class=MatplotlibShell)
>   File "C:\Python25\lib\site-packages\IPython\Shell.py", line 74, in __init__
>     debug=debug,shell_class=shell_class)
>   File "C:\Python25\Lib\site-packages\IPython\ipmaker.py", line 95, in 
> make_IPyt
> hon
>     embedded=embedded,**kw)
>   File "C:\Python25\lib\site-packages\IPython\Shell.py", line 589, in __init__
>     user_ns,b2 = self._matplotlib_config(name,user_ns)
>   File "C:\Python25\lib\site-packages\IPython\Shell.py", line 530, in 
> _matplotli
> b_config
>     import matplotlib.pylab as pylab
>   File "c:\python25\Lib\site-packages\matplotlib\pylab.py", line 292, in 
> <module
> >
>     from matplotlib.pyplot import *
>   File "c:\python25\Lib\site-packages\matplotlib\pyplot.py", line 37, in 
> <module
> >
>     new_figure_manager, draw_if_interactive, show = pylab_setup()
>   File "c:\python25\Lib\site-packages\matplotlib\backends\__init__.py", line 
> 24,
>  in pylab_setup
>     globals(),locals(),[backend_name])
>   File "c:\python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py", 
> lin
> e 8, in <module>
>     import tkagg                 # Paint image to Tk photo blitter extension
>   File "c:\python25\Lib\site-packages\matplotlib\backends\tkagg.py", line 1, 
> in
> <module>
>     import _tkagg
> ImportError: No module named _tkagg
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to