4

The default backend for my matplotlib is 'agg'. I read on stackoverflow (How can I set the 'backend' in matplotlib in Python?) that in order to display graphics I need to use TkAgg, WX, QTAgg, or QT4Agg. I tried using all 4 (mpl.use('TkAgg') etc) and matplotlib cannot find any of them (I cannot use QTAgg or QT4Agg because it is not compatible with python3 according to matplotlib). I'm not sure what is wrong since when I go to /usr/local/lib/python3.3/dist-packages/matplotlib/backends/, tkagg.py and backend_tkagg.py are both there. These errors all apply to wx also.

I use python3.3 on Quantal if that has any relevance.

Community
  • 1
  • 1
Will Hua
  • 1,729
  • 2
  • 23
  • 33

1 Answers1

5

I was getting the same error on Fedora 18. I installed the matplotib package for Python 3 from the repository.

Installing the package python3-matplotlib-tk got rid of this error for me on Fedora.

On Ubuntu, install the tk-dev package, and install matplotlib again: python3 setup.py build and python3 setup.py install.

However, I soon ran into this one on Fedora: Python 3 and matplotlib lissue on Linux

Community
  • 1
  • 1
  • You may want to move the second part of your answer to a new question. – steko Mar 30 '13 at 09:41
  • Am I doing something wrong? I typed 'sudo apt-get install python3-matplotlib-tk' into the terminal but it says that it is unable to locate the packagee. – Will Hua Mar 30 '13 at 17:48
  • @user2163653 Added to my answer. Install tk-dev and rebuild and reinstall should help. –  Mar 31 '13 at 00:24