[MacPorts] #71316: No event loop integration for 'macosx'

MacPorts noreply at macports.org
Thu Nov 14 19:03:38 UTC 2024


#71316: No event loop integration for 'macosx'
-------------------------+------------------------------
 Reporter:  AgilentGCMS  |      Owner:  (none)
     Type:  defect       |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  ports        |    Version:  2.10.4
 Keywords:               |       Port:  py311-matplotlib
-------------------------+------------------------------
 This morning I upgraded from macports 2.10.2 to 2.10.4, and then ran a
 `port selfupdate && port upgrade outdated`. After the upgrade, I can no
 longer do `ipython --pylab` for interactive plotting in matplotlib. I get
 the error `UnknownBackend: No event loop integration for 'macosx'.
 Supported event loops are: qt, qt5, qt6, gtk, gtk2, gtk3, gtk4, tk, wx,
 pyglet, glut, osx, asyncio`. Here is the full traceback.
 {{{
 ipython --pylab
 Python 3.11.10 (main, Sep  7 2024, 05:47:53) [Clang 15.0.0
 (clang-1500.3.9.4)]
 Type 'copyright', 'credits' or 'license' for more information
 IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help.
 [TerminalIPythonApp] WARNING | GUI event loop or pylab initialization
 failed
 ---------------------------------------------------------------------------
 UnknownBackend                            Traceback (most recent call
 last)
 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/IPython/core/shellapp.py:278, in
 InteractiveShellApp.init_gui_pylab.<locals>.<lambda>(key)
     276 shell = self.shell
     277 if self.pylab:
 --> 278     enable = lambda key: shell.enable_pylab(key,
 import_all=self.pylab_import_all)
     279     key = self.pylab
     280 elif self.matplotlib:

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/IPython/core/interactiveshell.py:3719, in
 InteractiveShell.enable_pylab(self, gui, import_all, welcome_message)
    3692 """Activate pylab support at runtime.
    3693
    3694 This turns on support for matplotlib, preloads into the
 interactive
    (...)
    3715     This argument is ignored, no welcome message will be
 displayed.
    3716 """
    3717 from IPython.core.pylabtools import import_pylab
 -> 3719 gui, backend = self.enable_matplotlib(gui)
    3721 # We want to prevent the loading of pylab to pollute the user's
    3722 # namespace as shown by the %who* magics, so we execute the
 activation
    3723 # code in an empty namespace, and we update *both* user_ns and
    3724 # user_ns_hidden with this information.
    3725 ns = {}

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/IPython/core/interactiveshell.py:3665, in
 InteractiveShell.enable_matplotlib(self, gui)
    3662     import matplotlib_inline.backend_inline
    3664 from IPython.core import pylabtools as pt
 -> 3665 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
    3667 if gui != None:
    3668     # If we have our first gui selection, store it
    3669     if self.pylab_gui_select is None:

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/IPython/core/pylabtools.py:346, in
 find_gui_and_backend(gui, gui_select)
     344 if gui in ("auto", None):
     345     backend = matplotlib.rcParamsOrig["backend"]
 --> 346     backend, gui = backend_registry.resolve_backend(backend)
     347 else:
     348     gui = _convert_gui_to_matplotlib(gui)

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/matplotlib/backends/registry.py:354, in
 BackendRegistry.resolve_backend(self, backend)
     351 else:  # Might be _auto_backend_sentinel or None
     352     # Use whatever is already running...
     353     from matplotlib import get_backend
 --> 354     backend = get_backend()
     356 # Is backend already known (built-in or dynamically loaded)?
     357 gui = (self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK.get(backend) or
     358        self._backend_to_gui_framework.get(backend))

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/matplotlib/__init__.py:1281, in get_backend()
    1273 def get_backend():
    1274     """
    1275     Return the name of the current backend.
    1276
    (...)
    1279     matplotlib.use
    1280     """
 -> 1281     return rcParams['backend']

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/matplotlib/__init__.py:764, in RcParams.__getitem__(self,
 key)
     762     if val is rcsetup._auto_backend_sentinel:
     763         from matplotlib import pyplot as plt
 --> 764         plt.switch_backend(rcsetup._auto_backend_sentinel)
     766 return self._get(key)

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/matplotlib/pyplot.py:400, in switch_backend(newbackend)
     398 for candidate in candidates:
     399     try:
 --> 400         switch_backend(candidate)
     401     except ImportError:
     402         continue

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/matplotlib/pyplot.py:521, in switch_backend(newbackend)
     518     close("all")
     520 # Make sure the repl display hook is installed in case we become
 interactive.
 --> 521 install_repl_displayhook()

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/matplotlib/pyplot.py:312, in install_repl_displayhook()
     310 # trigger IPython's eventloop integration, if available
     311 if ipython_gui_name:
 --> 312     ip.enable_gui(ipython_gui_name)

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/IPython/terminal/interactiveshell.py:977, in
 TerminalInteractiveShell.enable_gui(self, gui)
     973     self.active_eventloop = self._inputhook = None
     975 if gui and (gui not in {None, "webagg"}):
     976     # This hook runs with each cycle of the `prompt_toolkit`'s
 event loop.
 --> 977     self.active_eventloop, self._inputhook =
 get_inputhook_name_and_func(gui)
     978 else:
     979     self.active_eventloop = self._inputhook = None

 File
 ~/packages/macports/sonoma/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/IPython/terminal/pt_inputhooks/__init__.py:128, in
 get_inputhook_name_and_func(gui)
     125     return gui, registered[gui]
     127 if gui not in backends:
 --> 128     raise UnknownBackend(gui)
     130 if gui in aliases:
     131     return get_inputhook_name_and_func(aliases[gui])

 UnknownBackend: No event loop integration for 'macosx'. Supported event
 loops are: qt, qt5, qt6, gtk, gtk2, gtk3, gtk4, tk, wx, pyglet, glut, osx,
 asyncio
 }}}
 Here is info about my current `py311-matplotlib`:
 {{{
 $ port info py311-matplotlib
 py311-matplotlib @3.9.2 (python, graphics, math)
 Variants:             [+]cairo, dvipng, ghostscript, gtk3, latex, pdftops,
 pyside2, qt5, tkinter, universal

 Description:          Matplotlib strives to produce publication quality 2D
 graphics for interactive graphing, scientific publishing, user interface
 development and web application
                       servers targeting multiple user interfaces and
 hardcopy output formats. There is a 'pylab' mode which emulates matlab
 graphics. The library uses numpy for
                       handling large data sets and supports a variety of
 output backends. This port provides variants for the different GUIs (gtk2,
 gtk3, tkinter, qt4, qt5, cairo,
                       latex).
 Homepage:             https://matplotlib.org/

 Build Dependencies:   py311-setuptools_scm, pkgconfig, py311-certifi,
 py311-pybind11, ninja, py311-build, py311-installer, py311-meson-python
 Library Dependencies: freetype, qhull, py311-contourpy, py311-cycler,
 py311-dateutil, py311-fonttools, py311-kiwisolver, py311-numpy,
 py311-parsing, py311-packaging, py311-Pillow,
                       py311-cairo, python311
 Platforms:            darwin
 License:              (PSF or BSD)
 Maintainers:          Email: reneeotten at macports.org, GitHub: reneeotten
                       Policy: openmaintainer
 }}}
 I have done the naive thing of replacing `macosx` by `osx` as backend in
 my `~/.matplotlib/matplotlibrc`, but that has not fixed this issue.

-- 
Ticket URL: <https://trac.macports.org/ticket/71316>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list