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

pip install --upgrade pip breaks pip, still #5432

Closed
jmdugan opened this issue May 22, 2018 · 9 comments
Closed

pip install --upgrade pip breaks pip, still #5432

jmdugan opened this issue May 22, 2018 · 9 comments
Labels
auto-locked Outdated issues that have been locked by automation type: support User Support

Comments

@jmdugan
Copy link

jmdugan commented May 22, 2018

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

  1. Get package from '...'
  2. Then run '...'
  3. An error occurs.

Output

Paste the output of the steps above, including the commands themselves and
pip's output/traceback etc.
@jmdugan
Copy link
Author

jmdugan commented May 22, 2018

How to Reproduce:

sudo apt install python-pip

pip install --upgrade pip

pip --version

@pradyunsg
Copy link
Member

Hey @jmdugan!

Do the instructions in #5221 (comment) help?

@jmdugan
Copy link
Author

jmdugan commented May 22, 2018

@pradyunsg thank you, the same output:

[J]/bin >hash -r pip
[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
[J]/bin >hash -d pip
[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
[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

@RonnyPfannschmidt
Copy link
Contributor

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

@benoit-pierre
Copy link
Member

benoit-pierre commented May 22, 2018

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?

@benoit-pierre
Copy link
Member

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?

@xavfernandez xavfernandez added the type: support User Support label May 22, 2018
@gearcapitan
Copy link

i have the same problem!! help...
kali_linux-2018-06-03-15-27-15

@xavfernandez
Copy link
Member

Closed in favor of #5599

@lock
Copy link

lock bot commented May 31, 2019

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.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 31, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation type: support User Support
Projects
None yet
Development

No branches or pull requests

6 participants