"E: Unable to locate package python-pip" on Ubuntu 18.04

PythonLinuxUbuntuPipUbuntu 18.04

Python Problem Overview

I am trying to install virtualenv on Ubuntu.

First it said command 'pip' not found, so I typed

sudo apt install python-pip

then it said

E: Unable to locate package python-pip

I tried to reset WSL, download using cmd but it doesn't work with Ubuntu. I don't know why. Even though I have downloaded python3, virtualenv, and pip using cmd. It doesn't work with Ubuntu 18.04. It also fails on Ubuntu 14.04.

aiki@LAPTOP-886AEJJG:~$ pip

Command 'pip' not found, but can be installed with:

sudo apt install python-pip

aiki@LAPTOP-886AEJJG:~$ sudo apt install python-pip
[sudo] password for aiki:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip

I'm trying to install jarvis and mycroft on win 10, but I need to use Ubuntu because it only works with Linux.

Python Solutions

Solution 1 - Python

ls /bin/python*

Identify the highest version of python listed. If the highest version is something like python2.7 then install python2-pip If its something like python3.8 then install python3-pip

Example for python3.8:

sudo apt-get install python3-pip

Solution 2 - Python

Try following command sequence on Ubuntu terminal:

sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python-pip

Solution 3 - Python

Try the following commands in terminal, this will work better:

apt-get install curl

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

python get-pip.py

Solution 4 - Python

On some kind of Linux, like distros based on Debian, you might want to consider updating your 'apt-get' first, in case you are installing python-pip through it.

sudo apt-get update

This might help apt-get to update its indexes and locate the python-pip package. After this, u might install it like this-

sudo apt-get install python-pip (Python2)
sudo apt-get install python3-pip (Python3)

Solution 5 - Python

You might have python 3 pip installed already. Instead of pip install you can use pip3 install.

Solution 6 - Python

To solve the problem of:

E: Unable to locate package python-pip

you should do this. This works with the python2.7 and you not going to get disappointed by it. follow the steps that are mention below. go to get-pip.py and copy all the code from it.
open the terminal using CTRL + ALT +T

vi get-pip.py

paste the copied code here and then exit from the vi editor by pressing

ESC then :wq => press Enter

lastly, now run the code and see the magic

sudo python get-pip.py

It automatically adds the pip command in your Linux.
you can see the output of my machine

Solution 7 - Python

I'm using WSL2 on Windows 10 and I had the same issue. Try the way which helped me to fix this. I assume that you are using python3.

python3 get-pip.py
sudo apt install python3-pip


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAikiView Question on Stackoverflow
Solution 1 - PythonCharlesView Answer on Stackoverflow
Solution 2 - PythonBetaDevView Answer on Stackoverflow
Solution 3 - PythonAugustine JoseView Answer on Stackoverflow
Solution 4 - PythonANUP SAJJANView Answer on Stackoverflow
Solution 5 - PythonpfrankView Answer on Stackoverflow
Solution 6 - PythonAnubhav SharmaView Answer on Stackoverflow
Solution 7 - PythonAnh TranView Answer on Stackoverflow