Opened 4 years ago

Last modified 4 years ago

#60175 closed defect

cannot import name '_tkagg' from 'matplotlib.backends' in python 2.7 and python 3.8 — at Version 3

Reported by: lpagani91 Owned by: reneeotten (Renee Otten)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: Cc:
Port: py-matplotlib

Description (last modified by mf2k (Frank Schima))

I have problems importing tkagg in a python program, though it used to work (I ran the same python program in the past):

In [9]: matplotlib.__version__                                                  
Out[9]: '3.1.3'
In [10]: from matplotlib.backends.backend_tkagg import FigureCanvasTkagg        
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-10-b2c6c8b92aa8> in <module>
----> 1 from matplotlib.backends.backend_tkagg import FigureCanvasTkagg

/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backends/backend_tkagg.py in <module>
----> 1 from . import _backend_tk
      2 from .backend_agg import FigureCanvasAgg
      3 from ._backend_tk import (
      4     _BackendTk, FigureCanvasTk, FigureManagerTk, NavigationToolbar2Tk)
      5 

/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backends/_backend_tk.py in <module>
     20 from matplotlib.figure import Figure
     21 from matplotlib.widgets import SubplotTool
---> 22 from . import _tkagg
     23 
     24 try:

ImportError: cannot import name '_tkagg' from 'matplotlib.backends' (/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/matplotlib/backends/__init__.py)

I searched the web but all similar problems were linked to Windows or Ubuntu. Tkinter was not installed in my latest Python versions so I added it and some people mention that I should uninstall matplotlib and reinstall it after having installed Tkinter but it did not help.

Change History (3)

comment:1 Changed 4 years ago by mf2k (Frank Schima)

In the future, please use WikiFormatting and add the port maintainer(s) to Cc (port info --maintainers py38-matplotlib), if any.

comment:2 Changed 4 years ago by mf2k (Frank Schima)

Keywords: python libraries removed
Owner: set to reneeotten
Port: py-matplotlib added; pyxx-matplotlib removed
Status: newassigned

comment:3 Changed 4 years ago by mf2k (Frank Schima)

Description: modified (diff)
Note: See TracTickets for help on using tickets.