look thsi https://bugs.launchpad.net/ubuntu/+source/matplotlib/+bug/299381/comments/5. It seems the issue is caused by an incomplete cleanup and leaves outdated *.pyc.