Upgraded and installed macports on Mojave, resulting in "ImportError: cannot import name _tkagg"

Balthasar Indermuehle balt at inside.net
Mon May 6 07:24:01 UTC 2019

I have python code that depends on the TkAgg matplotlib backend. I have
upgraded and reinstalled all macports after upgrading to Mojave 10.14.4
following the migration instructions here
https://trac.macports.org/wiki/Migration and all seems to work fine, with
the exception of the tkagg backend it can't seem to locate.

Before I mess anything up by force uninstalling and reinstallng py-tkinter,
does anyone have suggestions on what else to try first?

Here's the exact error I get on trying to run this code:

Python 2.7.16 (default, Apr  1 2019, 14:50:41)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.use("TkAgg",warn=False, force=True)
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show =
line 63, in pylab_setup
    [backend_name], 0)
line 4, in <module>
    from . import tkagg  # Paint image to Tk photo blitter extension.
line 9, in <module>
    from matplotlib.backends import _tkagg
ImportError: cannot import name _tkagg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20190506/ced6143b/attachment.html>

More information about the macports-users mailing list