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

170,525

Solution 1

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 2

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 3

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

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

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

Share:
170,525
Aiki
Author by

Aiki

Updated on July 05, 2022

Comments

  • Aiki
    Aiki almost 2 years

    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.

  • Aiki
    Aiki about 5 years
    what does this mean "aiki@LAPTOP-886AEJJG:~/Jarvis$ ./setup.sh Specify python version(2/3)(Default-3)3 Selected python version 3 Running virtualenv with interpreter /usr/bin/python3 Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 22, in <module> import distutils.spawn ModuleNotFoundError: No module named 'distutils.spawn'"
  • BetaDev
    BetaDev about 5 years
    make sure python3 and pip3 if you are using version 3 and also make sure about the module that you have imported is i stalled using pip3. check the python version and pip version then check if the imported module on your code is available under those versions of python and pip.
  • BetaDev
    BetaDev about 5 years
    for any other new problem, post new question on stack overflow but first search stack overflow for you new problem.
  • Aiki
    Aiki about 5 years
    how do i check the pip version? do i just type pip3?
  • BetaDev
    BetaDev about 5 years
    pip --version and python --version. For you new problem, post new question on stack.
  • hasany
    hasany over 3 years
    Hi, I have python2.7 installed in "/usr/lib/python2.7" and "/usr/local/bin/python2.7", when I run "sudo apt-get install python2-pip" it gives same error: "Unable to locate package python2-pip" ls /bin/python* outputs: bin/python3 /bin/python3.8 /bin/python3-futurize /bin/python3-pasteurize Is my python2.7 installed on wrong place?
  • desgua
    desgua over 3 years
    This is the right answer for most having this problem IMHO.
  • Tony Chou
    Tony Chou over 3 years
    @Aiki use python3 -m pip --version
  • Emre Tapcı
    Emre Tapcı over 3 years
    Does not work in a docker container derived from ubuntu:latest
  • nocomment
    nocomment about 3 years
    I agree with @desgua.In my case whenever I ran python --version from the terminal it said Python 2.7.2. When I checked in the /bin/python*, however, there were several other 3.x versions installed. Worth checking out.
  • alper
    alper about 3 years
    Does not work in a google instance
  • Snackoverflow
    Snackoverflow about 3 years
    sudo apt-get install python2-pip yields E: Unable to locate package python2-pip