pip: My pip is broken. _internal module cannot be imported.
Maintainer note: Anyone that still gets this issue please see #5599.
- Pip version: 8.1.1
- Python version: 2.7.12
- Operating system: Ubuntu 16.04 (64 bit)
Description:
my pip is broken. it cannot update. It also complains error when just type pip.
What Iβve run:
pip
Traceback (most recent call last):
File "/usr/local/bin/pip", line7, in <module>
from pip._internal import main
ImportError: No module named _internal
Also tried sudo pip
or sudo su; pip
, with same output.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 23 (2 by maintainers)
I just change the
from pip._internal import main
intofrom pip import main
and Voila! Problem dismissedBy typing:
the problem disappears. Strange.
This solution works with me xD
or use sudo for the higher permission:
Of course, we can use python3 instead of python π
Ref
sudo python -m pip install -U pip==8.0.1
As indicated by @mahxn0, I did:
sudo python -m pip install -U pip == 8.0.1
After this:
sudo pip install -U pip
And itβs working normally now π
I had the same problem, so that I applied your strange method:
sudo apt remove python-pip
and it solved my problem as well. I think it is about the version difference. Because before I removed pip, I upgraded pip from 8 to 10. After I removed pip, I checked the version of pip and output showed that I have pip with version of 10. And problem disappeared π @zchrissirhczItβs a bad idea to
sudo pip install -U pip
.https://github.com/pypa/pip/issues/5599#issuecomment-414157896 solved for me
and then do
I had to use the -H option to sudo for it work.
sudo -H python get-pip.py --force-reinstall
This works for me in Python3 and Ubuntu 18.04.
Install pip3:
Upgrade pip3:
I solved this by updating pip via Python, like this:
python2 -m pip install --user --upgrade pip
python3 -m pip install --user --upgrade pip
Iβd suggest looking at #5599 as for the root cause of this issue, and for describing what fixes it.
hi the brothers excuse me I have a problem with my mac OS, I already have a Python version 2.7 and I installed version 3.6 but I still have the system that puts me 2.7 in my / Library and I do not know what to do I can not even install modules on my IDE
@PavelNiedoba In my case, I first update pip with pip, then remove
python-pip
package on Ubuntu with apt.