14
$ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package python-pip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python3-pip

both my pip and pip3 are installed in python 3

pip -V
pip 20.1.1 from /usr/lib/python3/dist-packages/pip (python 3.8)


pip3 -V
pip 20.1.1 from /usr/lib/python3/dist-packages/pip (python 3.8)

Now i cant install pip ...it shows above error

daniel lugo
  • 165
  • 1
  • 2
  • 9
  • if you run `python -m pip -V`, what is the output? – Goldwave Oct 03 '20 at 18:27
  • /usr/bin/python: No module named pip – daniel lugo Oct 03 '20 at 18:31
  • Have you tried `apt update` first? – Goldwave Oct 03 '20 at 18:36
  • bro all are up to date ....pip is not uninstalling....it shows : Package python-pip is not installed, so it will not be purged – daniel lugo Oct 03 '20 at 18:41
  • while typing pip in terminal it shows pip description – daniel lugo Oct 03 '20 at 18:42
  • Didnt answer my question. But moving on, try to uninstall pip3? python-pip3 – Goldwave Oct 03 '20 at 18:49
  • while uninstalling both pip and pip3 are gone and when installing pip it didnt show the package ...when pip3 installing both pip also installing – daniel lugo Oct 04 '20 at 04:40
  • In my case I had to get "get-pip.py" from https://bootstrap.pypa.io/2.6/get-pip.py in order to work. More detailed here: https://stackoverflow.com/questions/50045697/curl-for-get-pip-py-does-not-work-syntax-error – Nuno Realista Jan 23 '21 at 17:15
  • @daniellugo "/usr/bin/python: No module named pip" -> is this python 2 or python 3? Try `python3 -m pip -V` and tell us if you still have this problem. Also try `python --version` to check the actual version of this binary. Also use `which python` to tell you where the binary is located. – klaar Jul 07 '22 at 11:51

3 Answers3

43

If you have python(python2) installed you then you can use following command to install pip(for python2).

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py

Now you can check for pip2

pip2 --version

I hope these will help you

Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161
Shingala_Yagnik
  • 462
  • 4
  • 4
  • 3
    For users coming back to this python2.7 requires you use a specific version of get-pip: https://bootstrap.pypa.io/pip/2.7/get-pip.py – jimbob88 Apr 17 '21 at 16:55
  • The binary blob in that file is little scary but pypa.io is the "Python Packaging Authority", a legitimate part of the Python Software Foundation. Hopefully this will help any other concerned individuals! – Shrout1 Aug 05 '22 at 21:13
0

Just for reference, this problem can occur if you are using Windows Ubuntu Shell and your firewall is blocking your Ubuntu sandbox's traffic. In that case installation resources can not be found and simple apt-update will not work.

In order to test if the firwall causes your problem, you can simply try to ping a website. Also if apt-update will fail with connection refused the firwall is likely your problem. Check this post on how to add your sandbox to the firewall whitelist (Endpoint Protection).

DataBach
  • 1,330
  • 2
  • 16
  • 31
-5

Use these commands first then try again and perform a reinstallation by sudo apt reinstall python3-pip

  1. sudo add-apt-repository universe
  2. sudo add-apt-repository multiverse
  3. sudo apt-get update
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61