pip install --upgrade pip breaks pip, still
jmdugan opened this issue · 9 comments
Environment
- pip version: 10
- Python version: 2.7.12
- OS: Ubuntu 16.04
Description
I ran "pip install --upgrade pip"
now pip breaks, every time:
[J]~/bin >pip --version
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in
from pip import main
ImportError: cannot import name main
I tried "sudo apt remove python-pip" and a full autoremove, and re-installed pip, and it's still broken
Another ticket, from April 16 is now closed, relates to the same error message
#5240
How do we downgrade or fix this?
Expected behavior
How to Reproduce
- Get package from '...'
- Then run '...'
- An error occurs.
Output
Paste the output of the steps above, including the commands themselves and
pip's output/traceback etc.
How to Reproduce:
sudo apt install python-pip
pip install --upgrade pip
pip --version
Hey @jmdugan!
Do the instructions in #5221 (comment) help?
@pradyunsg thank you, the same output:
[J]/bin >hash -r pip/bin >pip -version
[J]
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in
from pip import main
ImportError: cannot import name main
[J]/bin >hash -d pip/bin >pip -version
[J]
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in
from pip import main
ImportError: cannot import name main
[J]~/bin >pip install --upgrade --user pip
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in
from pip import main
ImportError: cannot import name main
also tried
sudo apt purge python-pip
then, reinstall, and it's still gives:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in
from pip import main
ImportError: cannot import name main
it seems the pip you installed in a unsupported manner (as you overwrote the system managed one) is in a location thats different from the system one, thus it keeps overriding, please check your dist and site packages folder for git installs matching the undesired ones that break your pip binary
You probably don't have the directory where the new pip is installed in your PATH. I think one of Ubuntu/Debian patches to pip is to install to /usr/local
per default (when run as root, and without --user
). Do you have a pip in /usr/local/bin
?
Scratch that, the patch was about installing to /usr/local
when run as root (of course). Did you use sudo
for the pip install --upgrade pip
command too?
Closed in favor of #5599
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.