FS#32646 - [python2-matplotlib] pyplot gives ImportError: cannot import name _tkagg
Attached to Project:
Community Packages
Opened by Patrick (freethebee) - Wednesday, 14 November 2012, 10:40 GMT
Last edited by Stéphane Gaudreault (stephane) - Thursday, 29 November 2012, 11:04 GMT
Opened by Patrick (freethebee) - Wednesday, 14 November 2012, 10:40 GMT
Last edited by Stéphane Gaudreault (stephane) - Thursday, 29 November 2012, 11:04 GMT
|
Details
Description: Importing matplotlib.pyplot or starting
ipython2 --pylab gives the error
ImportError: cannot import name _tkagg Changing the mpl backend to for example gtk gives, ImportError: Gtk* backend requires pygtk to be installed. Even though pygtk is installed. Additional info: The problem appeared with package version 1.2.0-2 and occurs both for python-matplotlib and python2-matplotlib. The AUR package python-matplotlib-git works fine. I updated it to be sure it doesn't occur with the current version (10 or 11 Nov). The whole error in ipython2, In [4]: import matplotlib.pyplot --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-4-6f467123fe04> in <module>() ----> 1 import matplotlib.pyplot /usr/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>() 95 96 from matplotlib.backends import pylab_setup ---> 97 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() 98 99 @docstring.copy_dedent(Artist.findobj) /usr/lib/python2.7/site-packages/matplotlib/backends/__init__.pyc in pylab_setup() 23 backend_name = 'matplotlib.backends.%s'%backend_name.lower() 24 backend_mod = __import__(backend_name, ---> 25 globals(),locals(),[backend_name]) 26 27 # Things we pull in from all backends /usr/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py in <module>() 9 10 # Paint image to Tk photo blitter extension ---> 11 import matplotlib.backends.tkagg as tkagg 12 13 from matplotlib.backends.backend_agg import FigureCanvasAgg /usr/lib/python2.7/site-packages/matplotlib/backends/tkagg.py in <module>() 1 from __future__ import print_function ----> 2 from matplotlib.backends import _tkagg 3 import Tkinter as Tk 4 5 def blit(photoimage, aggimage, bbox=None, colormode=1): ImportError: cannot import name _tkagg Steps to reproduce: $ ipython (or ipython2) >>> import matplotlib.pyplot Or: $ ipython2 --pylab |
This task depends upon
Closed by Stéphane Gaudreault (stephane)
Thursday, 29 November 2012, 11:04 GMT
Reason for closing: Fixed
Additional comments about closing: packages in [community-testing]
Thursday, 29 November 2012, 11:04 GMT
Reason for closing: Fixed
Additional comments about closing: packages in [community-testing]
import pylab as P
fig = P.figure()
P.show()
it raises:
from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _backend_gdk
gtk = False
gtkagg = False
tkagg = False
wxagg = False
macosx = False
Commenting these lines or deleting them gives the default option of 'auto' for these settings. This lets matplotlib build the gui extensions if dependencies are met, otherwise they are silently ignored. This is also what is used for the git version on the AUR. Commenting these lines fixed the issue for me.
Could you please try packages from this url
https://dev.archlinux.org/~stephane/matplotlib/
and let me know if they work for you ?