brew install python3 didn't install pip3

Question:

I installed python3 using homebrew but it didn’t install pip3 or should I say it installed but it doesn’t recognize the command ?

Here is what I did:

brew install python3

This installed python3 but threw an error at the end saying it couldn’t link python3 and prompted me to run

brew link python3

to link the installation but this throws another error:

Linking /usr/local/Cellar/python3/3.6.3... Error: Permission denied @ dir_s_mkdir - /usr/local/lib 

Does anyone know how solve this ?
When I run:

brew info python3

It says:

==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>

They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html

Which makes me think pip3 is installed but not recognized. Any help is appreciated.

INFO:

OS => MacOS High Sierra 10.13.1

 pip3 install twilio
-bash: pip3: command not found
Asked By: Alexander Luna

||

Answers:

Ok it took me a lot of googling but the problem is that in high sierra all permissions inside usr/local changed and homebrew has to create some folder inside usr/local. Here is how I solved everything:

I tried using sudo brew install python3 but that also threw an error
directly from Homebrew telling me that it doesn’t allow the use of
sudo brew.

Create the folders I needed using sudo mkdir inside /usr/local:

sudo mkdir lib 
sudo mkdir Frameworks

Change the permissions inside /usr/local so that homebrew can access them:

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

Now install python3

brew install python3

This will give you a successful installation:

==> Pouring python3-3.6.3.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>

They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html
==> Summary
   /usr/local/Cellar/python3/3.6.3: 3,588 files, 56.1MB
Answered By: Alexander Luna

GitHub user @aether2501, commenting on a sudo chown solution for a “Homebrew Permission Denied” problem, suggests instead that Homebrew be uninstalled/reinstalled after the upgrade to High Sierra.

I successfully used @aether2501’s reinstall command, /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)", on High Sierra (10.13.2) without uninstalling brew first.

In addition to creating the /usr/local/Frameworks directory and setting the necessary ownership and permissions I needed to link python3, it also appears to have fixed other directory issues.

Answered By: Jonathan

I had the same issue and used:

sudo -H pip3 install virtualenv
sudo -H pip3 install virtualenvwrapper --ignore-installed six
Answered By: Heather Akpan

After resolving the linking issue (e.g. https://github.com/Homebrew/homebrew-core/issues/19286 ), python3 is installed but not pip3. Reinstalling python (e.g. brew reinstall python) eventually installs pip3 as well. These steps works well for me.

Answered By: Tin Torres

In my case, this fixed the issue:

brew unlink [email protected]; brew link [email protected]

(You might have to replace the version number with the version you have installed)

Answered By: Tomfox

I wanted to add my own solution to this exact problem.

On MacOS [specifically Ventura] I did brew install python – it turns out homebrew does actually install pip, but the difference is that the actual command to use is now pip3 instead of "pip".

As a result, I aliased the command pip to equal pip3 by adding this line to my .zshrc (though if you are working with a bash shell, it’ll work as well):

alias pip="pip3"

When the time comes that pip moves to a ver.4, I’ll have to update this, but for now, it has solved my issue without any further linking or PATH changes.

Answered By: Rich Werden