<p>pip install --upgrade pip bricht pip</p>

Erstellt am 24. Juli 2019  ·  6Kommentare  ·  Quelle: pypa/pip

Dieser Fehler kommt # 5432 "pip install --upgrade pip bricht pip immer noch" sehr nahe.

Umgebung

  • pip-Version: pip 19.2.1 aus /usr/local/lib/python3.7/site-packages/pip (Python 3.7)
  • Python-Version: Python 3.7.4
  • Betriebssystem: MacOS Mojave 10.14.5 (18F132)

Ich benutze den Homebrew-Paketmanager: Homebrew 2.1.89-07-23

Beschreibung

In der ursprünglichen brew install python -Installation ist /usr/local/bin/pip3 ein Symlink. Es erreicht schließlich seine Zieldatei: /usr/local/Cellar/python/3.7.4/bin/pip3 .

In der brew info python -Hilfe wird empfohlen, nicht versionierte Symlinks bei /usr/local/opt/python/libexec/bin : /usr/local/opt/python/libexec/bin/pip ist ein Symlink zu /usr/local/Cellar/python/3.7.4/bin/pip3 .

pip install --upgrade pip erstellt eine neue Datei /usr/local/bin/pip anstatt das Ziel des Symlinks zu aktualisieren, dh /usr/local/Cellar/python/3.7.4/bin/pip3 . Darüber hinaus wird diese letztere Datei nicht aktualisiert.

Wenn der PFAD /usr/local/opt/python/libexec/bin/pip vor /usr/local/bin/pip , schlägt alles fehl ...

Erwartetes Verhalten

Beim Aktualisieren von pip sollte /usr/local/bin/pip ein Symlink zu /usr/local/opt/python/libexec/bin/pip .

Wie zu reproduzieren

  1. Reinigen Sie alle pip
    find -E /usr/local/ -type f -iregex '.*/pip[23]?' -print -delete
  1. Installieren Sie python mit Homebrew
    brew reinstall python

  2. Überprüfen Sie den Status von / usr / local / bin / pip * usw. und suchen Sie nach ähnlichen i-Knoten.
    NB: Beachten Sie, dass es keine /usr/local/bin/pip .

ls -li /usr/local/bin/pip*
ls -li /usr/local/opt/python/libexec/bin/pip
ls -li /usr/local/opt/python/libexec/bin/../../bin/pip3
ls -li /usr/local/bin/../Cellar/python/3.7.4/bin/pip3
  1. Aktualisieren Sie pip mit pip
    /usr/local/opt/python/libexec/bin/pip install --upgrade pip

  2. Wiederholen Sie Schritt 3 oben.

  3. Ausprobieren
    /usr/local/bin/pip --version

  4. Ausprobieren
    /usr/local/opt/python/libexec/bin/pip --version

Ausgabe

pommeau:~ bouge$ find -E /usr/local/ -type f -iregex '.*/pip[23]?' -print -delete

/usr/local//bin/pip3
/usr/local//bin/pip
find: /usr/local//etc/FileWaveInstallers/FlatPackage-Microsoft_Office_2019_VL_Serializer.pkg: Permission denied
find: /usr/local//etc/FileWaveInstallers/FlatPackage-Microsoft_AutoUpdate_4.3.18090901_Updater.pkg: Permission denied
find: /usr/local//etc/FileWaveInstallers/FlatPackage-Microsoft_Office_16.17.18090901_Installer.pkg: Permission denied
/usr/local//Cellar/python/3.7.4/bin/pip3

pommeau:~ bouge$ brew reinstall python

==> Reinstalling python 
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.4.mojave.bottle.
Already downloaded: /Users/bouge/Library/Caches/Homebrew/downloads/ffcfe300e2ad205387a2bdd27185d98d64621578d26d2f6ccbbcd091ff799fc8--python-3.7.4.mojave.bottle.tar.gz
==> Pouring python-3.7.4.mojave.bottle.tar.gz
==> /usr/local/Cellar/python/3.7.4/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.4/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.4/bin/python3 -s setup.py --no-user-cfg install
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python<strong i="24">@2</strong>

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺  /usr/local/Cellar/python/3.7.4: 3,869 files, 60MB

pommeau:~ bouge$ ls -li /usr/local/bin/pip*

17870036 lrwxr-xr-x  1 bouge  wheel    34B  4 mar 14:11 /usr/local/bin/pip2@ -> ../Cellar/python@2/2.7.16/bin/pip2
17870037 lrwxr-xr-x  1 bouge  wheel    36B  4 mar 14:11 /usr/local/bin/pip2.7@ -> ../Cellar/python@2/2.7.16/bin/pip2.7
36689213 lrwxr-xr-x  1 bouge  wheel    31B 24 jul 15:54 /usr/local/bin/pip3@ -> ../Cellar/python/3.7.4/bin/pip3
36689214 lrwxr-xr-x  1 bouge  wheel    33B 24 jul 15:54 /usr/local/bin/pip3.7@ -> ../Cellar/python/3.7.4/bin/pip3.7
12675428 -rwxr-xr-x@ 1 bouge  wheel   263B 16 jan  2019 /usr/local/bin/pip_upgrade_outdated*

pommeau:~ bouge$ ls -li /usr/local/opt/python/libexec/bin/pip
36689211 lrwxr-xr-x  1 bouge  staff    14B 24 jul 15:54 /usr/local/opt/python/libexec/bin/pip@ -> ../../bin/pip3

pommeau:~ bouge$ ls -li /usr/local/opt/python/libexec/bin/../../bin/pip3
36689157 -rwxr-xr-x  1 bouge  staff   386B 24 jul 15:54 /usr/local/opt/python/libexec/bin/../../bin/pip3*

pommeau:~ bouge$ ls -li /usr/local/bin/../Cellar/python/3.7.4/bin/pip3
36689157 -rwxr-xr-x  1 bouge  staff   386B 24 jul 15:54 /usr/local/bin/../Cellar/python/3.7.4/bin/pip3*

pommeau:~ bouge$ /usr/local/opt/python/libexec/bin/pip install --upgrade pip

Collecting pip
  Using cached https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.1.1
    Uninstalling pip-19.1.1:
      Successfully uninstalled pip-19.1.1
Successfully installed pip-19.2.1

pommeau:~ bouge$ ls -li /usr/local/bin/pip*

36690799 -rwxr-xr-x  1 bouge  wheel   234B 24 jul 15:55 /usr/local/bin/pip*
17870036 lrwxr-xr-x  1 bouge  wheel    34B  4 mar 14:11 /usr/local/bin/pip2@ -> ../Cellar/python@2/2.7.16/bin/pip2
17870037 lrwxr-xr-x  1 bouge  wheel    36B  4 mar 14:11 /usr/local/bin/pip2.7@ -> ../Cellar/python@2/2.7.16/bin/pip2.7
36690800 -rwxr-xr-x  1 bouge  wheel   234B 24 jul 15:55 /usr/local/bin/pip3*
36690801 -rwxr-xr-x  1 bouge  wheel   234B 24 jul 15:55 /usr/local/bin/pip3.7*
12675428 -rwxr-xr-x@ 1 bouge  wheel   263B 16 jan  2019 /usr/local/bin/pip_upgrade_outdated*

pommeau:~ bouge$ ls -li /usr/local/opt/python/libexec/bin/pip
36689211 lrwxr-xr-x  1 bouge  staff    14B 24 jul 15:54 /usr/local/opt/python/libexec/bin/pip@ -> ../../bin/pip3

pommeau:~ bouge$ ls -li /usr/local/opt/python/libexec/bin/../../bin/pip3
36689157 -rwxr-xr-x  1 bouge  staff   386B 24 jul 15:54 /usr/local/opt/python/libexec/bin/../../bin/pip3*

pommeau:~ bouge$ ls -li /usr/local/bin/../Cellar/python/3.7.4/bin/pip3
36689157 -rwxr-xr-x  1 bouge  staff   386B 24 jul 15:54 /usr/local/bin/../Cellar/python/3.7.4/bin/pip3*

pommeau:~ bouge$ /usr/local/bin/pip --version

pip 19.2.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

pommeau:~ bouge$ /usr/local/opt/python/libexec/bin/pip --version

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 19.2.1 (/usr/local/lib/python3.7/site-packages), Requirement.parse('pip==19.1.1'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/opt/python/libexec/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3241, in <module>
    <strong i="25">@_call_aside</strong>
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3225, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==19.1.1' distribution was not found and is required by the application
crash macos downstream bug

Hilfreichster Kommentar

Die folgenden Schritte haben mein Problem behoben. Teilen Sie es mit, falls jemand es braucht:

cp /usr/local/opt/python/libexec/bin/pip /usr/local/opt/python/libexec/bin/pip_ORIG
mv /usr/local/bin/pip /usr/local/opt/python/libexec/bin/pip
ln -s /usr/local/opt/python/libexec/bin/pip /usr/local/bin/pip
pip --version

Gutschrift für diesen Beitrag.

Alle 6 Kommentare

Könnten Sie ein Problem mit Homebrew einreichen, das mit diesem verknüpft ist?

Ich denke, sie sind in einer besseren Position, um dies anzugehen, als die Betreuer von pip. Wir werden gerne mit ihnen zusammenarbeiten, um dieses Problem zu lösen, wenn sie der Meinung sind, dass Upstream Pip etwas tun sollte.

Ich hatte immer das Gefühl, dass Homebrew pip patchen sollte, daher empfiehlt die Nachricht brew upgrade pip anstelle des (eingebauten) Befehls pip install . Ich glaube, Debian macht das schon (nicht sicher über RPM).

pip könnte dies einfacher machen, indem z. B. die Befehlszeichenfolge zu einer globalen Variablen gemacht wird (anstatt in _internal.utils.outdated inline vergraben zu werden), aber zuerst muss Homebrew bereit sein, den Patch zu akzeptieren.

Die folgenden Schritte haben mein Problem behoben. Teilen Sie es mit, falls jemand es braucht:

cp /usr/local/opt/python/libexec/bin/pip /usr/local/opt/python/libexec/bin/pip_ORIG
mv /usr/local/bin/pip /usr/local/opt/python/libexec/bin/pip
ln -s /usr/local/opt/python/libexec/bin/pip /usr/local/bin/pip
pip --version

Gutschrift für diesen Beitrag.

Bitte erwägen Sie, ein Problem bei Homebrew einzureichen

Amateurarbeit ...

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen