3

I ran sudo apt-get install python-pip from terminal. But I got the following error :-

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

And when I ran the commmand sudo apt-get install python-setuptools python-dev build-essential. from terminal, I got the following error :-

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python-setuptools
E: Unable to locate package python-dev
E: Unable to locate package build-essential.
E: Couldn't find any package by glob 'build-essential.'
E: Couldn't find any package by regex 'build-essential.'

How do I solve this issue?

2 Answers2

10

It seems that all Ubuntu repositories(main, universe, restricted, multiverse) are not enabled. That's why, you are getting Unable to locate <package> errors. To do it, run the following commands(one-by-one) from Terminal :-

sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse
sudo apt update

Also in the second command, i.e. sudo apt-get install python-setuptools python-dev build-essential., you didn't name the package build-essentialcorrectly. So you got this error :-

E: Couldn't find any package by glob 'build-essential.'
E: Couldn't find any package by regex 'build-essential.'

You can use a different method to install pip in Ubuntu 17.10. To do it, run the following commands(one-by-one) from Terminal :-

sudo apt install curl
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
sudo python3 /tmp/get-pip.py
pip install --user pipenv
echo "PATH=$HOME/.local/bin:$PATH" >> ~/.profile
source ~/.profile

References

4

Have you downloaded the apt package registry? Make sure you start with a $ sudo apt update, confirm you can get package updates with $ sudo apt update -y

Also, make sure your system isn't busted. Perhaps post your error messages? Can't install python-pip

  • This worked in my case, I was having the same error. After doing {sudo apt update}. It prompted me to {sudo apt upgrade}. This resolved the issue. Thanks! – Mobeen Oct 27 '17 at 03:20