Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Incompatibility to `matplotlib<3.5.2`

Offen
#54 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
jupyter-notebook, matplotlib, python

Rechercherichtung

Beginne mit matplotlib_inline/backend_inline.py, insbesondere _enable_matplotlib_integration(), und reproduziere den gemeldeten Import mit matplotlib==3.5.1, numpy==1.24.1 und jupyter. Erledigt ist die Aufgabe, wenn der Import von matplotlib.pyplot in einem Notebook mit matplotlib-Versionen unter 3.5.2 ohne den gemeldeten AttributeError funktioniert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

When trying to import matplotlib in a jupyter notebook with matplotlib version smaller than 3.5.2 I get an error with the new release version 0.2.1. I understand the insentive of not having the direct dependency but I guess something should be done to prevent this. It works with both, the older matplotlib-inline version as well as newer matplotlib versions (>=3.5.2)

To reproduce

Install dependencies

pip install matplotlib==3.5.1 numpy==1.24.1 jupyter

Then open a jupyter notebook and try

import matplotlib.pyplot as plt

which will yield the following error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 1
----> 1 import matplotlib.pyplot as plt

File ~\temp\venv\lib\site-packages\matplotlib\pyplot.py:2230
   2228     dict.__setitem__(rcParams, "backend", rcsetup._auto_backend_sentinel)
   2229 # Set up the backend.
-> 2230 switch_backend(rcParams["backend"])
   2232 # Just to be safe.  Interactive mode can be turned on without
   2233 # calling `plt.ion()` so register it again here.
   2234 # This is safe because multiple calls to `install_repl_displayhook`
   2235 # are no-ops and the registered function respect `mpl.is_interactive()`
   2236 # to determine if they should trigger a draw.
   2237 install_repl_displayhook()

File ~\temp\venv\lib\site-packages\matplotlib\pyplot.py:267, in switch_backend(newbackend)
    260 # Backends are implemented as modules, but "inherit" default method
    261 # implementations from backend_bases._Backend.  This is achieved by
    262 # creating a "class" that inherits from backend_bases._Backend and whose
    263 # body is filled with the module's globals.
    265 backend_name = cbook._backend_module_name(newbackend)
--> 267 class backend_mod(matplotlib.backend_bases._Backend):
    268     locals().update(vars(importlib.import_module(backend_name)))
    270 required_framework = _get_required_interactive_framework(backend_mod)

File ~\temp\venv\lib\site-packages\matplotlib\pyplot.py:268, in switch_backend.<locals>.backend_mod()
    267 class backend_mod(matplotlib.backend_bases._Backend):
--> 268     locals().update(vars(importlib.import_module(backend_name)))

File ~\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py:127, in import_module(name, package)
    125             break
    126         level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~\temp\venv\lib\site-packages\matplotlib_inline\__init__.py:1
----> 1 from . import backend_inline, config  # noqa
      3 __version__ = "0.2.1"
      5 # we can't ''.join(...) otherwise finding the version number at build time requires
      6 # import which introduces IPython and matplotlib at build time, and thus circular
      7 # dependencies.

File ~\temp\venv\lib\site-packages\matplotlib_inline\backend_inline.py:236
    231                 ip.events.unregister("post_run_cell", configure_once)
    233             ip.events.register("post_run_cell", configure_once)
--> 236 _enable_matplotlib_integration()
    239 def _fetch_figure_metadata(fig):
    240     """Get some metadata to help with displaying a figure."""

File ~\temp\venv\lib\site-packages\matplotlib_inline\backend_inline.py:218, in _enable_matplotlib_integration()
    216     backend = matplotlib.get_backend(auto_select=False)
    217 else:
--> 218     backend = matplotlib.rcParams._get("backend")
    220 if ip and backend in ("inline", "module://matplotlib_inline.backend_inline"):
    221     from IPython.core.pylabtools import activate_matplotlib

AttributeError: 'RcParams' object has no attribute '_get'
Vorherrschende Sprache
Jupyter Notebook
Sterne
31
Forks
39
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ipython/matplotlib-inline

Alle Issues in ipython/matplotlib-inline

Ähnliche Issues

Weitere Issues zu Backend & API Design

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.