Python Versionen und Terminalbefehle

imacer

imacer

Aktives Mitglied
Thread Starter
Dabei seit
23.01.2003
Beiträge
2.854
Reaktionspunkte
1.103
Moin, ich nutze einen älteren iMac mit macOS 10.12.6 (Sierra)
Die Python-Version 2.7.10 war wohl vom Werk aus drauf...wüsste jedenfalls nicht, dass ich sowas je installiert habe.
Da ich nun aber mal den auf Python basierenden PlanetarySystemStacker ausprobieren möchte, muss ich meine Python Version aktualiseren.
Von der Seite Python.org habe ich eine aktuelle Version 3.12. installiert...war wohl auch erfolgreich. Wenn ich im termianl aber "python --version" eingebe spuckt er mir immer noch die 2.7. aus.
Ich bin absoluter Anfänger auf dem Gebiet, wie bekomme ich die aktuelle Version ins System, um über pip3 den PSS zu installieren?
Habe es auch über Homebrew versucht, aber da kommt kurz vor Schluss eine Fehlermeldung, bzgl. eines falschen Pfades. Deswegen würde ich das gerne weglassen und nur über das Terminal gehen, was eigentlich kein Problem wäre, wenn eine Python Version 3.x läuft...

Muss ich über das Terminal erst die Python Version 3.12. aufrufen und von da etwas über pip installieren? Wenn ja wie? :)

Fehler beim Installationsversuch.
Bildschirmfoto 2023-11-11 um 18.47.07.png

Terminal-Python.jpg

Danke für eine Anlaufhilfe.
imacer

Befehl in neuem Terminalfenster angenommen aber Fehlermeldung. Ist das wirklich so schwer, oder bin ich zu ungeschickt? :(
Code:
Last login: Sat Nov 11 18:46:03 on ttys002
iMac:~ Christian$ pip install planetary-system-stacker
-bash: pip: command not found
iMac:~ Christian$ pip3 install planetary-system-stacker
Collecting planetary-system-stacker
  Using cached planetary_system_stacker-0.9.8.3-py3-none-macosx_10_6_intel.whl.metadata (5.2 kB)
Collecting numpy<1.23.0 (from planetary-system-stacker)
  Using cached numpy-1.22.4.zip (11.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
ERROR: Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 245, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/commands/install.py", line 377, in run
    requirement_set = resolver.resolve(
                      ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
    result = self._result = resolver.resolve(
                            ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/resolvelib/resolvers.py", line 427, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/resolvelib/resolvers.py", line 239, in _attempt_to_pin_criterion
    criteria = self._get_updated_criteria(candidate)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/resolvelib/resolvers.py", line 230, in _get_updated_criteria
    self._add_to_criteria(criteria, requirement, parent=candidate)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria
    if not criterion.candidates
           ^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/resolvelib/structs.py", line 156, in __bool__
    return bool(self._sequence)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
    return any(self)
           ^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built
    candidate = func()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 211, in _make_candidate_from_link
    self._link_candidate_cache[link] = LinkCandidate(
                                       ^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 293, in __init__
    super().__init__(
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__
    self.dist = self._prepare()
                ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 225, in _prepare
    dist = self._prepare_distribution()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 304, in _prepare_distribution
    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/operations/prepare.py", line 525, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/operations/prepare.py", line 640, in _prepare_linked_requirement
    dist = _get_prepared_distribution(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/operations/prepare.py", line 71, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/distributions/sdist.py", line 54, in prepare_distribution_metadata
    self._install_build_reqs(finder)
  File "/Library/Frmeworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/distributions/sdist.py", line 124, in _install_build_reqs
    build_reqs = self._get_build_requires_wheel()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/distributions/sdist.py", line 101, in _get_build_requires_wheel
Code:
    return backend.get_requires_for_build_wheel()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/utils/misc.py", line 751, in get_requires_for_build_wheel
    return super().get_requires_for_build_wheel(config_settings=cs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworksython.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 166, in get_requires_for_build_wheel
    return self._call_hook('get_requires_for_build_wheel', {
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 321, in _call_hook
    raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
  File "/Library/Framorks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
    obj = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_remov
  File "/private/var/folders/4b/h0bkhfnn1zgb238c7g236n3c0000gn/T/pip-build-env-h9v2wq_x/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 10, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils'
 
Zuletzt bearbeitet von einem Moderator:
Python version 3 wird nicht mit "python" gestartet, sondern mit "python3".
 
  • Gefällt mir
Reaktionen: imacer
Sind also mehrere Versionen parallel installiert? Dachte, er updated 2.7 auf 3.12...
Aber auch wenn ich im Terminal pyhton3 starte und dann installieren will klappt es nicht :(

Last login: Sat Nov 11 19:12:50 on ttys003
iMac:~ Christian$ python3
Python 3.12.0 (v3.12.0:0fb18b02c8, Oct 2 2023, 09:45:56) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> pip3 install planetary-system-stacker
File "<stdin>", line 1
pip3 install planetary-system-stacker
^^^^^^^
SyntaxError: invalid syntax
>>> pip3 install planetary-system-stacker
File "<stdin>", line 1
pip3 install planetary-system-stacker
^^^^^^^
SyntaxError: invalid syntax

Das install ist "unterstrichen" wieso ist das denn falsch?
 
Du musst pip3 in der System-Shell aufrufen nicht in der Python-Shell.
 
  • Gefällt mir
Reaktionen: imacer
Oder in der Python-Shell mit:
Code:
import pip; pip.main(['install', 'planetary-system-stacker'])
 
  • Gefällt mir
Reaktionen: imacer
Dein planetary-system-stacker wird unter Linux (Fedora39) allerdings auch mit den gleichen Fehlermeldungen nicht installiert. Da scheint was kaputt zu sein.
 
  • Gefällt mir
Reaktionen: imacer
Danke, aber auch dann kommt am Ende wieder "no module named distutils" :(


File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_internal/utils/misc.py", line 751, in get_requires_for_build_wheel


return super().get_requires_for_build_wheel(config_settings=cs)


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 166, in get_requires_for_build_wheel



File "/private/var/folders/4b/h0bkhfnn1zgb238c7g236n3c0000gn/T/pip-build-env-zzic2558/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 10, in <module>


import distutils.core


ModuleNotFoundError: No module named 'distutils'
Dein planetary-system-stacker wird unter Linux (Fedora39) allerdings auch mit den gleichen Fehlermeldungen nicht installiert. Da scheint was kaputt zu sein.
Das heißt, da kann ich von meiner Seite aus erstmal nichts machen, oder ggf. bewusst eine ältere Version installieren?
 
Also müsste der PSS entsprechend auf Python 3.12 angepasst werden, oder ich installiere Python 3.10?
 
Ersteres wäre für alle Nachfolgenden die beste Lösung. Schreib doch die Entwickler mal an, vielleicht haben sie auch eine schnelle Lösung parat.
GitHub - Hier sind schon einige Fehler gemeldet.
 
  • Gefällt mir
Reaktionen: imacer und dg2rbf
Hab schon im Astroforum die Fehlermeldung gepostet, da ist der Entwickler auch aktiv und liest es sicher. Danke!!
 
Mit der 3.8 geht es, ich rufe es so auf:
Code:
 /Library/Frameworks/Python.framework/Versions/3.8/bin/PlanetarySystemStacker ; exit;
 
Muss ich erstmal Python downgraden oder die 3.12 deinstallieren oder wie gehe ich da vor?
Direkt die obere Befehlszeile ins Terminal kopieren??
 
Jo, direkt ins Terminal kopiert.
Ich hatte zwei Versionen drauf, die 3.8 und ich glaube die 3.10. Ich kanns nur nicht mehr 100% sagen weil ich in der Zwischenzeit einen neuen Mac habe.

Probier mal den Aufruf mit "python --version" bzw. "python3 --version" und schau Dir die Versionen an.
 
Also wenn die 3.8 nicht drauf ist,geht der Befehl nicht? Teste den Befehl gleich Mal, danke soweit! Das lässt hoffen.
 
Unter Linux habe ich es mit pyenv und einer nachinstallierten 3.8.18 auf anhieb zum Funktionieren gebracht. Mit homebrew, pyenv und 3.8.18 ist es auf einem M1-Mac nicht gelungen.
 
Das lässt hoffen, ich geh Mal an den Rechner ;)

Edit:
Habe jetzt die 3.8.9. drauf und es erscheint
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/4b/h0bkhfnn1zgb238c7g236n3c0000gn/T/tmpkdliw6dh Check the logs for full command output.


WARNING: You are using pip version 20.2.3; however, version 23.3.1 is available.


You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -m pip install --upgrade pip' command.

Versuche nun das pip upgrade...man ist das nervig, ich will doch nur das eine Programm :)

Pip update ist drauf, beim PSS sagt er

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
 
Zuletzt bearbeitet:
Nur zur Vervollständigung: bei mir läuft die 3.8.0, aber die 3.10.12 nicht...
 
Im Installskript von PSS ist angegeben >=3.5.1 <3.9, deswegen habe ich die letzte 3.8.xx benutzt.
 
Bei der 3.8 hatte ich ja die Fehlermeldung, was mache ich denn da anders als ihr?
Das steht als letztes im Terminal
error: metadata-generation-failed

Wie stelle ich denn sicher, dass er es unter der 3.8 installiert und nicht unter der 3.10 oder 3.12 die ich auch drauf habe.

Last login: Sat Nov 11 23:02:25 on ttys001
iMac:~ Christian$ python3 --version
Python 3.8.10

Passt soweit.
Dann mache ich ein neues Terminal Fesnter auf und gebe ein
pip3 install planetary-system-stacker

mit oben genanntem Ergebnis
 
Zurück
Oben Unten