[MacPorts] #60175: cannot import name '_tkagg' from 'matplotlib.backends' in python 2.7 and python 3.8

MacPorts noreply at macports.org
Tue Mar 10 14:01:07 UTC 2020


#60175: cannot import name '_tkagg' from 'matplotlib.backends' in python 2.7 and
python 3.8
----------------------------+------------------------
  Reporter:  lpagani91      |      Owner:  reneeotten
      Type:  defect         |     Status:  assigned
  Priority:  Normal         |  Milestone:
 Component:  ports          |    Version:  2.6.2
Resolution:                 |   Keywords:
      Port:  py-matplotlib  |
----------------------------+------------------------
Description changed by mf2k:

Old description:

> 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.

New description:

 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.

--

-- 
Ticket URL: <https://trac.macports.org/ticket/60175#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list