47
sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip

how to install python-pip in ubuntu:14.04?

Boyka
  • 869
R_SS
  • 581
  • 1
  • 6
  • 15

2 Answers2

78

python-pip is in the universe repositories, therefore use the steps below:

sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python-pip
A.B.
  • 90,397
  • sudo apt-add-repository universe Error : sudo: apt-add-repository: command not found – R_SS Sep 11 '15 at 09:22
  • 1
    @Ravi_SS sorry, forgot the installation of apt-add-repository. Install with sudo apt-get install software-properties-common as described now in my answer. Start again with the first command. – A.B. Sep 11 '15 at 09:25
  • apt-get update is working fine, but sudo apt-get update is giving me error.. And also sudo apt-get install software-properties-common is not working. – R_SS Sep 11 '15 at 12:15
  • On sudo apt-get install software-properties-common Err http://archive.ubuntu.com/ubuntu/ trusty/main libroken18-heimdal amd64 1.6~git20131207+dfsg-1ubuntu1 Could not resolve 'archive.ubuntu.com' – R_SS Sep 11 '15 at 12:24
  • Are you online? – A.B. Sep 11 '15 at 12:25
  • i am online yes – R_SS Sep 11 '15 at 12:36
  • Try to ping the host ping -c3 archive.ubuntu.com – A.B. Sep 11 '15 at 12:46
  • ping -c3 archive.ubuntu.com ping: unknown host archive.ubuntu.com – R_SS Sep 11 '15 at 12:57
  • Four your system your are not online. – A.B. Sep 11 '15 at 12:58
  • i was able to install python. apt-get install python – R_SS Sep 11 '15 at 13:00
  • sudo apt-get clean, now install python again and test it sudo apt-get install --reinstall python – A.B. Sep 11 '15 at 13:02
  • apt-get install --reinstall python Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 134 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main python amd64 2.7.5-5ubuntu3 [134 kB] Fetched 134 kB in 0s (604 kB/s) (Reading database ... 14423 files and directories currently installed.) Preparing to unpack .../python_2.7.5-5ubuntu3_amd64.deb ... Unpacking python (2.7.5-5ubuntu3) over (2.7.5-5ubuntu3) ... Setting up python (2.7.5-5ubuntu3) ... – R_SS Sep 11 '15 at 13:17
  • What can I say, it is the same server. archive.ubuntu.com/ubuntu – A.B. Sep 11 '15 at 13:19
  • Try it again with sudo apt-get install software-properties-common – A.B. Sep 11 '15 at 13:19
  • @Ravi_SS nice to hear, that your problem is solved, but sorry. I can't answer new questions in comments. But on AskUbuntu are many answers for the question about sources.list and sources.list.d ;) – A.B. Sep 11 '15 at 13:24
  • These instructions work on the Linux Subsystem for Windows as well. – KeithL Sep 20 '18 at 14:30
  • I'm a Dockerfile with base image ubuntu:latest (20.04). When building the image I run apt-get update -y, and in the next line apt-get install -y python-pip python-dev build-essential. I'm seeing the error "E: Unable to locate package python-pip" and I don't know why. Does anybody here know why? – Ethan Davis Apr 25 '20 at 23:29
  • unfortunately didn't work in Ubuntu 20.04 – Saddam Meshaal May 14 '20 at 20:59
  • 3
    With Ubuntu 20.04 I replaced sudo apt-get install python-pip with sudo apt-get install python3-pip it works properly – Saddam Meshaal May 14 '20 at 21:02
  • Failed for ubuntu kubuntu 20.04 – Amin Shojaei Sep 12 '20 at 07:03
21

I ran into this problem trying to install pip for python2; e.i. I wanted pip2. What worked for me was this:

sudo apt-get update && sudo apt-get install python-pip

Hope this helps someone.

anonymous2
  • 4,298
Robbotnik
  • 311