`pyimport` not working on NixOS
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Julia
- Sterne
- 1.5k
- Forks
- 186
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
PyCall.pyimport("matplotlib") produces:
ERROR: PyError (PyImport_ImportModule
The Python package matplotlib could not be imported by pyimport. Usually this means
that you did not install matplotlib in the Python version being used by PyCall.
PyCall is currently configured to use the Python version at:
/nix/store/58zz1ci0b4y6r6ypsl3ggz8fkqjl805f-python3-3.8.9-env/bin/python3.8
and you should use whatever mechanism you usually use (apt-get, pip, conda,
etcetera) to install the Python package containing the matplotlib module.
One alternative is to re-configure PyCall to use a different Python
version on your system: set ENV["PYTHON"] to the path/name of the python
executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.
Another alternative is to configure PyCall to use a Julia-specific Python
distribution via the Conda.jl package (which installs a private Anaconda
Python distribution), which has the advantage that packages can be installed
and kept up-to-date via Julia. As explained in the PyCall documentation,
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia. Then,
To install the matplotlib module, you can use `pyimport_conda("matplotlib", PKG)`,
where PKG is the Anaconda package that contains the module matplotlib,
or alternatively you can use the Conda package directly (via
`using Conda` followed by `Conda.add` etcetera).
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'matplotlib'")
But running /nix/store/58zz1ci0b4y6r6ypsl3ggz8fkqjl805f-python3-3.8.9-env/bin/python3.8 -c "import matplotlib" does not fail, so the interpreter is actually able to find the requested module.
Using PyCall v1.92.3
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne am Einstiegspunkt PyCall.pyimport und reproduziere den Fehler mit dem im Bericht gezeigten NixOS Python-Interpreter. Vergleiche diesen Aufruf mit dem direkten Python-Befehl, der matplotlib erfolgreich importiert. Als erledigt gilt die Aufgabe, wenn pyimport matplotlib im gemeldeten NixOS-Setup importieren kann und das relevante Verhalten durch einen Regressionstest abgedeckt ist, sofern das Projekt einen solchen bereitstellt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- julia, matplotlib, python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100