[Matplotlib-users] ImportError: cannot import name '_tkagg'

jcb0026 james.c.brenton at nasa.gov
Wed Nov 9 17:13:16 EST 2016


Greetings,
I'm trying to run a Python script that uses tkinter to create a GUI and
matplotlib to display a graph onto the GUI. Our System Administrators
installed Python 3.5, tkinter, and matplotlib onto a Redhat Linux 7.2
machine. Within the code of our script, to import all necessary matplotlib
functions and modules, we call: 

from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import matplotlib
matplotlib.use('TkAgg')

However, when the script is ran, this is the result:

  File "ourScript.py", line 17, in <module>
    from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
NavigationToolbar2TkAgg
  File
"/opt/rh/rh-python35/root/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 11, in <module>
    import matplotlib.backends.tkagg as tkagg
  File
"/opt/rh/rh-python35/root/usr/lib64/python3.5/site-packages/matplotlib/backends/tkagg.py",
line 2, in <module>
    from matplotlib.backends import _tkagg
ImportError: cannot import name '_tkagg'

After doing some research, it seems that this could be due to matplotlib
being installed before tkinter. Is this likely the case?

Thanks,
James










--
View this message in context: http://matplotlib.1069221.n5.nabble.com/ImportError-cannot-import-name-tkagg-tp47619.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


More information about the Matplotlib-users mailing list