ImportError: cannot import name '_tkagg'

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.

James,

Please subscribe to the mailing list so you can post un-moderated (
Matplotlib-users Info Page ).

What version of Matplotlib are you using and how did you install it?

If you built Matplotlib from source (prior to 1.5.3), we would only build
the `_tkagg` extension if we could find the tinker libraries and headers at
build time. I suspect re-building Matplotlib will fix your problem.

Tom

···

On Sat, Jan 28, 2017 at 10:57 AM jcb0026 <james.c.brenton at nasa.gov> wrote:

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.
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170128/c0e92ded/attachment-0001.html&gt;