193

I'm trying to install pip3, but I'm not having any luck. Also, I tried sudo install and it did not work. How could I install pip3 on my Mac?

sudo easy_install pip3
Password:
Searching for pip3
Reading https://pypi.python.org/simple/pip3/
Couldn't find index page for 'pip3' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
   
No local packages or download links found for pip3
error: Could not find suitable distribution for Requirement.parse('pip3')
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user3697597
  • 2,119
  • 3
  • 14
  • 13
  • 1
    To install or upgrade pip, download `get-pip.py` from the [official site](http://www.pip-installer.org/en/latest/installing.html) Then run the following command: `sudo python get-pip.py` and it will install the pip for your python version which runs the script. – doru Jan 03 '16 at 04:53
  • So, is it mac or ubuntu? In any case, I'd recommend not to mess with the system Python if you don't have to, and look into [`pyenv`](https://github.com/yyuu/pyenv) (it installs `pip` by default, too) – fjarri Jan 03 '16 at 04:59
  • 1
    I am assuming you have Python 2.X as if you had python3, you will also have pip3. If you have Python 2, then it makes more sense for you to install pip ( not pip3 ) so just try 'easy_install pip' – dkarchmer Jan 03 '16 at 05:47
  • 1
    @doru thanks it worked – user3697597 Jan 03 '16 at 07:27

12 Answers12

373

UPDATED - Homebrew version after 1.5

According to the official Homebrew page:

On 1st March 2018 the python formula will be upgraded to Python 3.x and a python@2 formula will be added for installing Python 2.7 (although this will be keg-only so neither python nor python2 will be added to the PATH by default without a manual brew link --force). We will maintain python2, python3 and python@3 aliases.

So to install Python 3, run the following command:

brew install python3

Then, the pip or pip3 is installed automatically, and you can install any package by pip install <package>.


The older version of Homebrew

Not only brew install python3 but also brew postinstall python3

So you must run:

brew install python3
brew postinstall python3

Note that you should check the console, as it might get you errors and in that case, the pip3 is not installed.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Blaszard
  • 30,954
  • 51
  • 153
  • 233
  • 2
    "brew install python" failed for me as it needed sudo. Then it wouldn't rerun as homebrew thought the install was success. Running "brew link python" "brew postinstall python" seems to have worked and now I have pip3 :-) – barclar Sep 26 '18 at 10:03
  • I have 1.7.6 but I can't install pip3. I can install python3. – AMIC MING Sep 27 '18 at 18:37
  • I had to do a brew reinstall python to get tit to work. – C.J. Apr 16 '19 at 17:25
  • 1
    This did not work for me. pip3 was not installed with python3 automatically. I removed it all - `brew uninstall python3`, went to official python and did it there. Worked. – Mote Zart May 25 '19 at 03:35
  • @MoteZart Did you run the post install command? It is necessary if you use the older version of home brew. – Blaszard May 25 '19 at 11:42
  • 4
    I'm running Homebrew 2.1.7 and had to run the `brew postinstall python3` command to get pip3. – matt123788 Aug 30 '19 at 16:14
95

You could use Homebrew.

Then just run:

brew install python3
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
aizimmer
  • 1,185
  • 8
  • 9
74

I solved the same problem with these commands:

curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
clemens
  • 16,716
  • 11
  • 50
  • 65
sunu_park
  • 751
  • 5
  • 6
26

For me brew postinstall python3 didn't work. I found this solution on the GitHub Homebrew issues page:

$ brew rm python
$ rm -rf /usr/local/opt/python
$ brew cleanup
$ brew install python3
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Oksana Romaniv
  • 1,569
  • 16
  • 18
20

Python 3 was working successfully, but without pip3. I tried advice from Stack Overflow, Quora and others (numerous installs and uninstalls).

Python 3 was always fine, but without pip3. Finally I downloaded Python3 from: https://www.python.org/downloads/

By simple mouse clicks and everything (Python 3 + pip3), it is working fine now.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Itai
  • 201
  • 2
  • 2
  • I was having a lot of problems trying to make pip3 work (installing with Homebrew) in my MacBook M1 and a fresh install from the web fixed it for me. Thanks a lot! – theITguy Nov 30 '21 at 18:34
  • I tried many options and failed. This simple solution works like a charm for me. I got pip immediately. – Golden Thumb May 23 '22 at 02:46
10

Similar to Oksana but add python3

$ brew rm python 
$ brew rm python3 
$ rm -rf /usr/local/opt/python
$ rm -rf /usr/local/opt/python3
$ brew prune 
$ brew install python3
$ brew postinstall python3

Seem now work for pip3 under mac os x 10.13.3 Xcode 9.2

Dennis Ng
  • 361
  • 3
  • 11
9

To install or upgrade pip, download get-pip.py from the official site. Then run the following command:

sudo python get-pip.py 

and it will install pip for your python version which runs the script.

doru
  • 9,022
  • 2
  • 33
  • 43
  • Where does pip get installed? it is still not found in my path nor the current directory with get-pip.py – AG1 Apr 14 '19 at 19:29
7

I ran the below where <user>:<group> matched the other <user>:<group> for other files in the /usr/local/lib/python3.7/site-packages/ directory:

sudo chown -R <user>:<group> /usr/local/lib/python3.7/site-packages/pip*
brew postinstall python3
tkjef
  • 704
  • 7
  • 17
6

I also encountered the same problem but brew install python3 does not work properly to install pip3.

brre will throw the warning The post-install step did not complete successfully.

It has to do with homebrew does not have permission to /usr/local

Create the directory if not exist

sudo mkdir lib 
sudo mkdir Frameworks

Give the permissions inside /usr/local to homebrew so it can access them:

sudo chown -R $(whoami) $(brew --prefix)/*

Now ostinstall python3

brew postinstall python3

This will give you a successful installation

Pay C.
  • 1,048
  • 1
  • 13
  • 20
  • `sudo chown -R $(whoami) $(brew --prefix)/*` does not work for me. This looks like bash scripting? What is `$(brew --prefix)/*`? Can you show an example of how to use proper syntax in terminal? – Ian G Sep 19 '19 at 22:57
4

After upgrading to macOS v10.15 (Catalina), and upgrading all my vEnv modules, pip3 stopped working (gave error: "TypeError: 'module' object is not callable").

I found question 58386953 which led to here and solution.

  1. Exit from the vEnv (I started a fresh shell)
  2. sudo python3 -m pip uninstall pip (this is necessary, but it did not fix problem, because it removed the base Python pip, but it didn't touch my vEnv pip)
  3. sudo easy_install pip (reinstalling pip in base Python, not in vEnv)
  4. cd to your vEnv/bin and type "source activate" to get into vEnv
  5. rm pip pip3 pip3.6 (it seems to be the only way to get rid of the bogus pip's in vEnv)
  6. Now pip is gone from vEnv, and we can use the one in the base Python (I wasn't able to successfully install pip into vEnv after deleting)
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jvonehr
  • 123
  • 8
0

Installing Pip3

  • Follow this link to download pip3 on your computer
  • Follow the instructions on the page and then after successfully downloading Pip3, run python3 get-pip.py in your terminal
  • This will install pip3 into your laptop and then you can check the installation of pip3 by running which pip3 in your terminal.

Now simply do pip3 install <package>

Shubham Kumar
  • 121
  • 1
  • 4
-1

If you're using Python 3, just execute python3 get-pip.py . It is just a simple command.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
parrotjack
  • 432
  • 1
  • 6
  • 18
  • 2
    Unless you've upgraded to new MacOS, and are running virtual environment. That's non-trivial. – jvonehr Dec 12 '19 at 07:10