matplotlib / matplotlib/ipympl

%matplotlib widget run time error

Offen
#559 10 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Jupyter Notebook
Sterne
1.7k
Forks
234
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello,
I saw an old issue about this topic, but I could not find a recent solution.
I am using a Linux machine, Python version 3.12.4. I created my environment and I installed matplotlib by using
pip install matplotlib

But when I run my code in VS code, I get a runtime error related to %matplotlib widget

RuntimeError Traceback (most recent call last)
File ~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:413, in BackendRegistry.resolve_gui_or_backend(self, gui_or_backend)
412 try:
--> 413 return self.resolve_backend(gui_or_backend)
414 except Exception: # KeyError ?

File ~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:375, in BackendRegistry.resolve_backend(self, backend)
374 if gui is None:
--> 375 raise RuntimeError(f"'{backend}' is not a recognised backend name")
377 return backend, gui if gui != "headless" else None

RuntimeError: 'widget' is not a recognised backend name

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last)
Cell In[3], line 8
3 from pathlib import Path
5 #import ephyviewer
6 #import spikeinterface_gui as sigui
----> 8 get_ipython().run_line_magic('matplotlib', 'widget')
9 get_ipython().run_line_magic('matplotlib', 'inline')
10 #%matplotlib notebook
...
414 except Exception: # KeyError ?
--> 415 raise RuntimeError(
416 f"'{gui_or_backend} is not a recognised GUI loop or backend name")

RuntimeError: 'widget is not a recognised GUI loop or backend name

Have you found a solution for this issue?
thank you

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, %matplotlib widget in der gemeldeten Linux-, Python-3.12.4- und VS-Code-Umgebung zu reproduzieren, und untersuche anschließend den in matplotlib/backends/registry.py gezeigten Pfad zur Backend-Auflösung. Vergleiche das Verhalten mit der Einrichtung der ipympl- und Jupyter-Integration; als abgeschlossen gilt die Aufgabe, wenn die Ursache und eine reproduzierbare Lösung für diese Konfiguration identifiziert sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
jupyter-notebook, matplotlib, python, vscode
Bereich
frontend, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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