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

bubble up error on python > `import matplotlib` (e.g. bogus MPLBACKEND)

Offen
#474 0 Kommentare 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
julia, matplotlib, python

Rechercherichtung

Reproduziere den ungültigen MPLBACKEND-Fall in Julia und vergleiche ihn mit dem Python-Traceback. Beginne bei PyPlot/src/init.jl rund um den im Stacktrace gezeigten init-Aufruf und untersuche dann den PyCall-Pfad pyimport_conda; fertig ist es, wenn der Import den zugrunde liegenden matplotlib-Fehler offenlegt und das unnötige Conda-Verhalten verstanden oder korrigiert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

julia> ENV["MPLBACKEND"]="aaaaaaaaaagtk";  import PyPlot;
[ Info: Installing matplotlib via the Conda matplotlib package...
[ Info: Running `conda install -y matplotlib` in root environment
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

ERROR: InitError: PyCall.PyError("PyImport_ImportModule", PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x0000000135d73760), PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x000000013a353b30), PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x000000013a35eaf0))
Stacktrace:
 [1] pyimport(::String) at /Users/goretkin/.julia/packages/PyCall/zqDXB/src/PyCall.jl:536
 [2] pyimport_conda(::String, ::String, ::String) at /Users/goretkin/.julia/packages/PyCall/zqDXB/src/PyCall.jl:700
 [3] pyimport_conda at /Users/goretkin/.julia/packages/PyCall/zqDXB/src/PyCall.jl:693 [inlined]
 [4] __init__() at /Users/goretkin/.julia/packages/PyPlot/XHEG0/src/init.jl:179
 [5] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:692
 [6] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:776
 [7] _require(::Base.PkgId) at ./loading.jl:1001
 [8] require(::Base.PkgId) at ./loading.jl:922
 [9] require(::Module, ::Symbol) at ./loading.jl:917
during initialization of module PyPlot

is different from

>>> import os; os.environ["MPLBACKEND"] = "aaaaaaagtk"
>>> import matplotlib
Traceback (most recent call last):
  File "/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/__init__.py", line 802, in __setitem__
    cval = self.validate[key](val)
  File "/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/rcsetup.py", line 266, in validate_backend
    else _validate_standard_backends(s))
  File "/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/rcsetup.py", line 64, in __call__
    % (self.key, s, list(self.valid.values())))
ValueError: Unrecognized backend string 'aaaaaaagtk': valid strings are ['GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'pdf', 'pgf', 'ps', 'svg', 'template']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/__init__.py", line 1317, in <module>
    rcParams['backend'] = os.environ.get('MPLBACKEND')
  File "/Users/goretkin/.julia/conda/3/lib/python3.7/site-packages/matplotlib/__init__.py", line 804, in __setitem__
    raise ValueError("Key %s: %s" % (key, str(ve)))
ValueError: Key backend: Unrecognized backend string 'aaaaaaagtk': valid strings are ['GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'pdf', 'pgf', 'ps', 'svg', 'template']
>>>

Seems also to be unnecessarily doing something with conda.

Vorherrschende Sprache
Julia
Sterne
489
Forks
90
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

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 JuliaPy/PyPlot.jl

Alle Issues in JuliaPy/PyPlot.jl

Ähnliche Issues

Weitere Issues zu Julia

Neue Issues direkt in Ihr Postfach

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