Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on ubuntu 13.10: "cannot import name _tkagg" #3

Open
bueler opened this issue Jan 25, 2014 · 3 comments
Open

on ubuntu 13.10: "cannot import name _tkagg" #3

bueler opened this issue Jan 25, 2014 · 3 comments

Comments

@bueler
Copy link
Member

bueler commented Jan 25, 2014

This command works on one of my ubuntu machines but not the other. It is from pism/examples/jako, of course:

+ python pism_regional.py -i gr1km.nc -o jakomask.nc -x 360,382 -y 1135,1176 -b 50
Traceback (most recent call last):
  File "pism_regional.py", line 15, in <module>
    import pylab as plt
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/pylab.py", line 269, in <module>
    from matplotlib.pyplot import *
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 98, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/backends/__init__.py", line 28, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_tkagg.py", line 11, in <module>
    import matplotlib.backends.tkagg as tkagg
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/backends/tkagg.py", line 2, in <module>
    from matplotlib.backends import _tkagg
ImportError: cannot import name _tkagg

It may be relevant that I am running python 2.7.5+ and that when I run ipython -pylab I get a message that says

Welcome to pylab, a matplotlib-based Python environment [backend: Qt4Agg].

That is, my Matplotlib does work with the Qt4Agg backend, but the gtkagg backend might not work for me.

Actually I would be happy for regional-tools to have a GUI-free mode (i.e. without needed a functioning gui to run). Or maybe that so defeats the purpose ...

@ckhroulev
Copy link
Member

"regional tools" use Tk and Tkinter for the GUI, so it's not that easy to switch to the Qt4Agg backend. :-(

I agree that the "batch" mode should not even try to import GUI-related modules. This is a bug and I will fix it.

@bueler
Copy link
Member Author

bueler commented Feb 4, 2014

I was able to get past this. Apparently the key steps were:

  • install debian packages tk and tk-dev
  • uninstall and then reinstall matplotlib using pip, i.e. sudo pip uninstall matplotlib and sudo pip install matplotlib

I would not have tried this except I found

http://stackoverflow.com/questions/13110403/matplotlib-backend-missing-modules-with-underscore

@sandwriter
Copy link

Thanks, nice solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants