Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tkagg backend problems

Tags:

matplotlib

I need to use the Tkagg backent to use matplotlib in a Tkinter program, and I received the "ImportError: No module named backend_tkagg" error message.

Looking around, I saw as one possible solution that I add to install the agg-dev libs, so I did (Fedora fc13 here): yum install agg agg-devel ... but the problem persisted.

I thought that maybe I had to reinstall matplotlib, so I issued a *easy_install -m matplotlib*, but no luck (though the same error message seems to come from a different file now, namely /usr/lib64/python2.6/site-packages/matplotlib/backends/init.py )

any ideas?

like image 679
alessandro Avatar asked Oct 17 '12 11:10

alessandro


2 Answers

I solved it by compiling matplotlib from source. It has Tkagg active by default. Only problem was it didn't compile Tkagg since I didn't have tk-devel installed... after installing it everything went ok.

So I still don't know if easy_install matplotlib doesn't use TkAgg by design, or if it too checked and noticed that I didn't have Tk.h installed, but anyway this is the way to go.

like image 177
alessandro Avatar answered Oct 03 '22 23:10

alessandro


I had this issue today.

By default, Tkagg was not available for me (Ubuntu 14.04), so I ran:

sudo apt-get install tk-dev libpng-dev libffi-dev dvipng texlive-latex-base

Then uninstalled and reinstalled matplotlib:

pip uninstall matplotlib
pip install matplotlib
like image 37
jeudyx Avatar answered Oct 04 '22 00:10

jeudyx