why is my pip not working [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



why is my pip not working [duplicate]



This question already has an answer here:



I wanted to usepip today but I get an error like:


pip


Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main



So I thought I'd purge and re-install (following https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/) but still got:


purge


install


$ sudo apt-get install python-pip
[sudo] password for ron:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
docutils-common liblept5 libtesseract3 linux-headers-4.4.0-127 linux-headers-4.4.0-127-generic linux-image-4.4.0-127-generic linux-image-extra-4.4.0-127-generic python3-colorama python3-dateutil python3-docutils python3-jmespath python3-pygments python3-roman python3-rsa
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
python-pip
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 144 kB of archives.
After this operation, 633 kB of additional disk space will be used.
Get:1 http://ca.archive.ubuntu.com/ubuntu xenial/universe amd64 python-pip all 8.1.1-2 [144 kB]
Fetched 144 kB in 0s (162 kB/s)
Selecting previously unselected package python-pip.
(Reading database ... 667382 files and directories currently installed.)
Preparing to unpack .../python-pip_8.1.1-2_all.deb ...
Unpacking python-pip (8.1.1-2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python-pip (8.1.1-2) ...
ron@regDesktopHome:~/docker$ pip -V
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main



How can I get my pip up & running correctly?



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





I'm not familiar with Docker, but maybe you should add pip to your Dockerfile, so Docker knows how to install Pip when recreating your image?
– jimbo1qaz
Aug 8 at 3:29





@jimbo1qaz this is outside docker and has nothing to do with it, I just happen to be in that directory...
– cerr
Aug 8 at 3:41




1 Answer
1



I'm not familiar with docker



Try change


from pip import main



to


from pip._internal import main



pip.main is deprecated since pip 10



EDIT



Sorry, I missed that your are using pip 8.1





Do you have any compelling reasons to edit a system file located in /usr/bin?
– jimbo1qaz
Aug 8 at 3:27





this is outside docker and has nothing to do with it, I just happen to be in that directory...
– cerr
Aug 8 at 3:42

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard