This question already has an answer here:

I was following a tutorial online for python and it had me do this:

akclark@enceladus:~$ pip install virtualenv 

But I got the following:

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

sudo apt install python-pip

Easy enough, right? So I try it..

akclark@enceladus:~$ sudo apt install python-pip 

But I get an error...

Reading package lists... Done
Building dependency tree Reading state information... Done
E: Unable to locate package python-pip

What am I doing wrong?

EDIT: Per Comments I have tried sudo apt update

EDIT2: I tried apt-cache madison python-pip and got

N: Unable to locate package python-pip

EDIT3: grep '^deb ' /etc/apt/sources.list showed

deb http://archive.ubuntu.com/ubuntu bionic main 
deb http://archive.ubuntu.com/ubuntu bionic-security main
deb http://archive.ubuntu.com/ubuntu bionic-updates main

marked as duplicate by karel, Kevin Bowen, Eric Carvalho, Zanna, guiverc Aug 2 '18 at 2:14

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.

  • sudo apt update then try again: sudo apt install python-pip – Ravexina Aug 1 '18 at 15:34
  • Done. Same result. =( – CryptoJones Aug 1 '18 at 15:35
  • what is the output of apt-cache madison python-pip? edit your question add the output. – Ravexina Aug 1 '18 at 15:39
  • N: Unable to locate package python-pip – CryptoJones Aug 1 '18 at 15:46
  • Also grep '^deb ' /etc/apt/sources.list – Ravexina Aug 1 '18 at 15:47

You have to enable universe category which contains python-pip package.

Open /etc/apt/sources.list using an editor, for example nano:

sudo nano /etc/apt/sources.list

then add universe at the end of each line, like this:

deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe 
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe

Press Ctrl+O to save the file.

then run:

sudo apt update

and finally:

sudo apt install python-pip
  • That worked. Thank you! Sorry for the newb question. – CryptoJones Aug 1 '18 at 15:59
  • It's okay ;) you're welcome :) – Ravexina Aug 1 '18 at 15:59
  • 7
    To add the 'universe' repo without having to manually edit sources.list, run sudo add-apt-repository universe. (Taken from askubuntu.com/a/481355/56431) – David P Dec 20 '18 at 6:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.