Community Packages

Please read this before reporting a bug:
http://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

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
Task Type Bug Report
Category Packages
Status Closed
Assigned To Stéphane Gaudreault (stephane)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

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]
Comment by Thomas Gastine (Tondu) - Sunday, 18 November 2012, 10:05 GMT
Same here with GTKAgg. When running a small script

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
Comment by Patrick (freethebee) - Monday, 19 November 2012, 20:29 GMT
The source of the issue lies in setup.cfg. Under the header [gui_support] it says,

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.
Comment by Stéphane Gaudreault (stephane) - Monday, 19 November 2012, 22:45 GMT
Please try python-matplotlib-1.2.0-4 from [community-testing].
Comment by Patrick (freethebee) - Tuesday, 20 November 2012, 13:21 GMT
Both the python and python2 package from [community-testing] gives me the _tkagg error. If I build the packages myself, using the scripts from [community-testing] in abs, it works fine though.
Comment by Stéphane Gaudreault (stephane) - Wednesday, 28 November 2012, 15:21 GMT
I found a patch and added back tkagg and gtkagg (only for python2 as we do not have a pygtk package for python3).

Could you please try packages from this url
https://dev.archlinux.org/~stephane/matplotlib/
and let me know if they work for you ?
Comment by Patrick (freethebee) - Wednesday, 28 November 2012, 18:40 GMT
Both work like a charm. Thanks for looking into this.

Loading...