pip: ModuleNotFoundError: No module named 'pip._internal'
Maintainer note: Anyone that still gets this issue please see #5599.
- Pip version: 10.0.1
- Python version: 3.6.5-2
- Operating system: 4.16.3-1-ARCH
Description:
sudo pip install --upgrade pip
using 9.0.1-3
.
$ pip3 -V
Traceback (most recent call last):
File "/usr/bin/pip3", line 7, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal'
What (other) I’ve run:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
# Back to 9.0.1-3
pacman -Sy --force python-pip
pip uninstall pip
python3 get-pip.py
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 21
- Comments: 28 (7 by maintainers)
Links to this issue
Commits related to this issue
- improved pip stability and error reporting related to https://github.com/pypa/pip/issues/5373 - fixes #727 by using `python -m pip` instead of `pip` - fixes bug where output is not printed upon fai... — committed to inmanta/inmanta-core by wouterdb 6 years ago
- improved pip stability and error reporting (#728) related to https://github.com/pypa/pip/issues/5373 - fixes #727 by using `python -m pip` instead of `pip` - fixes bug where output is not printed... — committed to inmanta/inmanta-core by wouterdb 6 years ago
I hit the same snag and just reinstalled pip:
This worked for me:
python3 -m pip install --user --upgrade pip
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
sudo easy_install3 pip
worked for meSimilar to #5221. The installed OS installed pip is doing something weird.
Are the following different?
@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
Works for me, Thanks.
@pradyunsg They are equal for the repo version 9.0.1
and different for 10.0.1:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
Worked for me
@swprojects It will be in the next release of pip. 😃
Thanks for filing this issue.
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.
sudo apt remove python3-pip
worked for me@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.
Also works for
python2
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.