Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade fails #6332

Closed
ghost opened this issue Mar 13, 2019 · 3 comments
Closed

Upgrade fails #6332

ghost opened this issue Mar 13, 2019 · 3 comments
Labels
type: support User Support

Comments

@ghost
Copy link

ghost commented Mar 13, 2019

Linux Mint 18

You are using pip version 8.1.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
emil@emil ~ $ pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.2MB/s 
Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
emil@emil ~ $ 

Now pip i broken:

emil@emil ~ $ pip install -U spacy
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main

Uninstalling pip yields version 19.03 somehow:

emil@emil ~ $ python -m pip uninstall pip
/home/emil/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Uninstalling pip-19.0.3:
  Would remove:
    /home/emil/.local/bin/pip
    /home/emil/.local/bin/pip2
    /home/emil/.local/bin/pip2.7
    /home/emil/.local/lib/python2.7/site-packages/pip-19.0.3.dist-info/*
    /home/emil/.local/lib/python2.7/site-packages/pip/*
Proceed (y/n)? y
  Successfully uninstalled pip-19.0.3
@ghost
Copy link
Author

ghost commented Mar 13, 2019

Looks like an old package is causing problems:

image

@chrahunt
Copy link
Member

This can happen as follows:

  1. On Ubuntu, the system pip has --user by default
  2. pip install --upgrade pip installs pip to the user site-packages directory
  3. ~/.local/bin is not on PATH or the shell has hashed pip to point to /usr/bin/pip
  4. On subsequent invocation of pip (which is routed to /usr/bin/pip), the user's site-packages directory has precedence and from pip import main tries to import the main module from the newer pip package which has moved everything to _internal, and the error message shows up as above.
  5. On uninstallation, python -m pip resolves to the pip.__main__ in the user site-packages directory and when looking for a pip to uninstall, resolves to the pip package in the user site-packages directory
  6. pip uninstalls itself

To confirm:

  1. Please confirm that ~/.local/bin is in PATH
  2. After step 2, please check the output of type pip. If it shows something like pip is hashed (/usr/bin/pip) then type hash -d pip (at least in bash) to forget the path association
  3. Continue as above and see if it works.

We can probably employ some heuristic to warn users about this (if parent process is bash and we added a script that exists in another PATH folder to an earlier PATH folder), but it would only apply going forward, so only users upgrading from e.g. 19.3 would benefit.

@chrahunt
Copy link
Member

Aw, this is a deleted account. :( In any case thanks, I made an issue so hopefully this gets better in the future.

@chrahunt chrahunt added the type: support User Support label Aug 12, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: support User Support
Projects
None yet
Development

No branches or pull requests

1 participant