-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ModuleNotFoundError: No module named 'pip._internal' #5373
Comments
Similar to #5221. The installed OS installed pip is doing something weird. Are the following different?
|
@pradyunsg They are equal for the repo version 9.0.1 $ python3 -m pip --version
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
$ pip3 --version
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6) and different for 10.0.1: $ sudo pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-10.0.1
$ python3 -m pip --version
/usr/bin/python3: No module named pip.__main__; 'pip' is a package and cannot be directly executed
$ pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 7, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal' |
You shouldn't be doing sudo pip. https://stackoverflow.com/questions/21055859/what-are-the-risks-of-running-sudo-pip Looking at this, it seems to be an issue of trying to use pip to modify what your OS package manager has installed (through the use of sudo). It's likely that is why things are breaking here. |
Maybe the following will work better?
|
I got the same error from upgrading pip I removed pip3 files from /usr/local/bin/ and pip folder from /usr/local/lib/python3.5/dist-packages and uninstalled python3-pip, before reinstalling and it works again |
@swprojects Your issue sounds like a distribution specific packaging issue. I request you to open an issue with your Linux Distribution and ask them to look into it. Thanks! |
the pip3 command is distribution managed - pip is completely unaware of it in general upgrading a distribution managed pip using pip is an act of vandalism and any following breakage is on the vandal who inflicted the issue |
Yeah I made the mistake of thinking a pip upgrade would be aware of distribution managed pip. But lesson learned! |
@swprojects It will be in the next release of pip. :) Thanks for filing this issue. |
I am having the same problem here with pip ... I tried what swprojects suggested, and after reinstall, I now get the following error:
How do I fix this? |
@jesswren Have you tried in a new shell instance? |
@jesswren did you try pip3 and not just pip? Installing python3-pip is for python3, then command is pip3. Likewise, if python2 then install python-pip, then command is pip. edit: may not be that, but ubuntu prompts the user to install pip if it is not installed. Not sure if debian does the same thing. |
This comment has been minimized.
This comment has been minimized.
The above worked for me |
|
I my broken also..... I fixed running command:
|
related to pypa/pip#5373 - fixes #727 by using `python -m pip` instead of `pip` - fixes bug where output is not printed upon failure of pip
related to pypa/pip#5373 - fixes #727 by using `python -m pip` instead of `pip` - fixes bug where output is not printed upon failure of pip
Works for me, Thanks. |
|
pip3 has been reinstalled into /usr/bin/. I've pointed shell there to call for pip, which has executed nominally then. |
This worked for me: |
THANK YOU! My pip broke suddenly for no apparent reason the other week and I've tried googling all kinds of error messages and troubleshooting and uninstalling and reinstalling. This is the only thing that's worked. |
I had the same issue |
Also works for |
Great! Thanks a lot! |
What works for me, albeit in a Python 2.7-only restricted environment, is to modify "my" virtualenv pip as follows. |
Windows10 18.09 |
version difference makes difference in calls. latest version can use pip3 install <package_name> |
Worked for me |
Maintainer note: Anyone that still gets this issue please see #5599.
Description:
sudo pip install --upgrade pip
using9.0.1-3
.What (other) I've run:
The text was updated successfully, but these errors were encountered: