46

I am unable to locate package python-pip:

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

How can I resolve this problem?

Jagdip Singh Sandhu
  • 1,195
  • 1
  • 8
  • 7
  • You should show the steps you took to install PIP by including the apt commands you ran to try to install python/pip so that someone can better help you. – Azeame Sep 18 '18 at 21:12
  • **BEWARE!** Ubuntu's `pip` can cause bizarre conflicts and shouldn't be used for system packages anyway. You might well want a local install of a modern `pip` (version 18 and beyond), and use it only for personal packages with the `--user` option. See [ImportError in system pip wrappers after an upgrade · Issue #5599 · pypa/pip](https://github.com/pypa/pip/issues/5599) – nealmcb Jun 10 '19 at 22:54
  • 1
    I am unable to locate package python-pip:" What does this mean? What were you trying to do when this error occurred? – Karl Knechtel May 26 '23 at 18:20
  • *All* the answers are missing explanations (they are essentially "try this" answers). *Why* is the change necessary? What is this "universe" thing? Can it be trusted (or to what degree)? What are the implications of the change? May it break something else? What versions of Ubuntu does it work for (or are supposed to)? What version (and edition) of Ubuntu was it tested on? Etc. – Peter Mortensen May 26 '23 at 18:27
  • From [the Help Center](https://stackoverflow.com/help/promotion): *"...always explain why the solution you're presenting is appropriate and how it works"*. – Peter Mortensen May 26 '23 at 18:33

7 Answers7

61

For Ubuntu 18.04 (Bionic Beaver), with Python 3.6.5, the python-pip package will install after:

sudo add-apt-repository universe
sudo apt-get update

Which is enabling the category universe

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jagdip Singh Sandhu
  • 1,195
  • 1
  • 8
  • 7
34

Following a clean install of Ubuntu 18.04 (via Vagrant), the following was installed successfully without any issues:

sudo apt-get update
sudo apt-get install -y python3-pip

Note that the Ubuntu 18.04 download today shipped with Python 3.6.8 installed. This may vary by the time of your reading this post.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Steven K7FAQ
  • 798
  • 1
  • 9
  • 17
25

First update and then install python3-pip. So the following two commands should work.

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install python3-pip
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
4

First run sudo apt-get upgrade. If you see ppa:some repository example launchpad.net not found or IP address not found then go to

Software & Updates, and then unmark the repositories causing the error. Then select the Ubuntu main server, and reload and run the commands

sudo apt-get update sudo apt-get autoremove sudo apt-get autoclean it will delete unwanted existing packages and clear cache then try

sudo apt-get update
sudo apt-get install -y python3-pip
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
3

These commands work for me:

sudo apt-get install python3-setuptools
sudo easy_install3 pip

This is the old way of installing pip and is especially useful for the old version of Ubuntu. But still it works fine for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
3

You have to clear the unwanted repository's code /etc/apt/sources.list or gedit /etc/apt/sources.list. Or another option is switch Ubuntu mirror; see how to change ubuntu mirror

sudo apt-get update; sudo apt-get install python3-pip;

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 1
    What do you mean by "clear"? Please add all information to your answer by editing it, instead of putting comments on your own answer – Nico Haase Mar 22 '20 at 18:32
  • sorry ,not clean but autoclean will clean unwanted packages and other stuffs basically some respositorys may be outdated or unavailable for downloading using main server respository of ubuntu it will increase your speed check if python2 interpreter is updated. –  Apr 18 '20 at 16:01
1

The other way is adding the universe category into the current sources.list file directly:

vi /etc/apt/sources.list

Then add the universe category at the end of each line:

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ataeifard
  • 21
  • 3
  • The best answer I would say..... after following several suggestion to edit the `/etc/apt/sources.list` in many forums, nothing worked..... This is the one that worked finally. I guess this should get the best answer. Basically I moved the `/etc/apt/sources.list` to `/etc/apt/sources.list.OLD` and then created fresh with listed above and just updated and continued normally. Everything works like a charm!.... Thanks – shams Sep 21 '20 at 18:40
  • What is this "universe" thing? Can it be trusted (or to what degree)? What is it supposed to contain? – Peter Mortensen May 26 '23 at 18:54