Matplotlib neu installieren. Need Help.

Probleme bei der Installation?
Antworten
Hillson
User
Beiträge: 22
Registriert: Dienstag 15. Mai 2018, 08:36

Ich habe es irgendwie geschafft meine matplotlib zu zerstören. Wenn ich matplotlib in einem Script nutzen möchte bekomme ich folgende Fehlermeldung:

Code: Alles auswählen

Traceback (most recent call last):
  File "/Users/.../Image_processing.py", line 2, in <module>
    import matplotlib.pyplot as plt
  File "/Users/.../anaconda3/envs/DeepAI/lib/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/Users/.../anaconda3/envs/DeepAI/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
    [backend_name], 0)
  File "/Users/.../anaconda3/envs/DeepAI/lib/python3.6/site-packages/matplotlib/backends/backend_macosx.py", line 17, in <module>
    from matplotlib.backends import _macosx
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

Process finished with exit code 1
Nun habe ich versucht die matplotlib Dateien auf meinem Mac zu löschen, um dann matplotlib über das Terminal neu installieren zu können. Die Dateien sind ja unter './anaconda3/envs/DeepAI/lib/python3.6/site-packages' zu finden. Wenn ich matplotlib aber nun neu übers Terminal installieren möchte bekomme ich folgendes gesagt:

Code: Alles auswählen

(DeepAI) Vodafone-WF87532-2:~ tobiashilbert$ python -mpip install matplotlib
Collecting matplotlib
  Using cached https://files.pythonhosted.org/packages/8a/d5/5337662b714c65100f3545ed3909e9478614d1ebf1f692a52981f3f5167b/matplotlib-2.2.2-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Requirement already satisfied: cycler>=0.10 in ./anaconda3/envs/DeepAI/lib/python3.6/site-packages/cycler-0.10.0-py3.6.egg (from matplotlib)
Requirement already satisfied: numpy>=1.7.1 in ./anaconda3/envs/DeepAI/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in ./anaconda3/envs/DeepAI/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: six>=1.10 in ./anaconda3/envs/DeepAI/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: pytz in ./anaconda3/envs/DeepAI/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: python-dateutil>=2.1 in ./anaconda3/envs/DeepAI/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: kiwisolver>=1.0.1 in ./anaconda3/envs/DeepAI/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: setuptools in ./anaconda3/envs/DeepAI/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib)
Installing collected packages: matplotlib
Successfully installed matplotlib-2.2.2
Aber du wurde irgendwie nichts Successfully installed. Die Dateien, welche ich zuvor per Hand gelöscht hatte, befinden sich auch wieder unter './anaconda3/envs/DeepAI/lib/python3.6/site-packages' aber wenn ich matplotlib nutzen möchte bekomme ich die gleiche Fehlermeldung wie oben zu sehen.

Jemand eine Idee wie ich die matplotlib wieder zum laufen bekomme?

Vielen Dank für die Hilfe.
__deets__
User
Beiträge: 14494
Registriert: Mittwoch 14. Oktober 2015, 14:29

Lösch doch das ganze anaconda env. Dann sollten auch diese Meta Infos verschwunden sein.
Hillson
User
Beiträge: 22
Registriert: Dienstag 15. Mai 2018, 08:36

Davor habe ich irgendwie Angst, weil das ein richtiger Krampf war das bei Pycharme einzubinden.
Benutzeravatar
ThomasL
User
Beiträge: 1366
Registriert: Montag 14. Mai 2018, 14:44
Wohnort: Kreis Unna NRW

Ich habe keinen Mac aber in Verbindung mit envs habe ich Anaconda3 unter Win10 schon mehrere Male komplett neu installieren müssen, weil irgendwas beim installieren von Paketen
in eine envs zerhackstückelt wurde.
Hast du schon versucht zuerst matplotlib mit pip zu deinstallieren?
Und hast du dir das hier angeschaut
"See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information."
Eventuell kann dir da jemand in den Anaconda Foren helfen.
Ich bin Pazifist und greife niemanden an, auch nicht mit Worten.
Für alle meine Code Beispiele gilt: "There is always a better way."
https://projecteuler.net/profile/Brotherluii.png
Hillson
User
Beiträge: 22
Registriert: Dienstag 15. Mai 2018, 08:36

Der Fehler hat wohl irgendwas mit den verwendeten Backends zu tun. Das Problem kann kompliziert und einfach gelöst werden. Ich habe mich für die einfache Lösung entschieden. Falls nochmal jemand den Fehler bekommt, einfach die matplotlib wie folg einbinden:

Code: Alles auswählen

import matplotlib
matplotlib.use('TkAgg')
Antworten