79

I want to install TensorFlow following these instructions: https://web.archive.org/web/20170627102751/https://www.tensorflow.org/versions/r0.12/get_started/os_setup#pip_installation

But when I try this code on terminal, it returns an error.

$ sudo pip3 install --upgrade $TF_BINARY_URL
sudo: pip3: command not found

So I installed Homebrew and tried to uninstall and reinstall python3-pip, but didn't work.

MakotonoMacBook-ea:~ makotomiyazaki$ brew uninstall python3-pip
Error: No such keg: /usr/local/Cellar/python3-pip

MakotonoMacBook-ea:~ makotomiyazaki$ brew install python3-pip
Error: No available formula with the name "python3-pip" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

What should I do for getting pip3? My OS is macOS High Sierra, and I have Python 3.6.2 already installed.

EDIT: I tried

python3 -m pip

and what's returned was this:

The directory '/Users/makotomiyazaki/Library/Caches/pip/http' or its 
parent directory is not owned by the current user and the cache has 
been disabled. Please check the permissions and owner of that 
directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/makotomiyazaki/Library/Caches/pip' or its parent 
directory is not owned by the current user and caching wheels has been 
disabled. check the permissions and owner of that directory. If 
executing pip with sudo, you may want sudo's -H flag.
You must give at least one requirement to install (see "pip help 
install")

I also tried which pip3, but just I don't know if it worked...

MakotonoMacBook-ea:~ makotomiyazaki$ sudo which pip3 install --upgrade $TF_BINARY_URL
/usr/bin/install
5
  • 1
    Does python3 -m pip work? You should be installing packages into a venv anyway, though. Commented Dec 28, 2017 at 21:49
  • Possible duplicate of bash: pip: command not found Commented Dec 28, 2017 at 21:52
  • Did you try which pip3? I have both python2 and python3 installed and since I am too lazy to set up aliases I will have to do the entire path. Commented Dec 28, 2017 at 21:53
  • Thanks for your comments, I tried both but it doesn't seem to have worked... Commented Dec 28, 2017 at 22:12
  • If python3 -m pip works, then you can run python3 -m pip install --upgrade pip and you will get back pip command Commented May 19 at 10:34

7 Answers 7

183

You would need to install pip3.

On Linux, run first sudo apt update. Then the command would be: sudo apt install python3-pip

On Mac, using brew, first brew install python3
Then brew postinstall python3

Try calling pip3 -V to see if it worked.

Sign up to request clarification or add additional context in comments.

8 Comments

This gives me an error error: could not create '/usr/local/lib/python3.6/site-packages/pip/_internal': Permission denied I will keep on investigating
@AmauryLiet can you specify which command gave you that error?
I ran brew postinstall python3 I tried brew uninstall python3 which wasn't enough, but this did the trick: sudo rm -rf /usr/local/lib/python3.6
brew postinstall python3 was what I needed
No package python3-pip available.
|
26

I had this issue and I fixed it using the following steps You need to completely uninstall python3-pip using:

sudo apt-get --purge autoremove python3-pip

Then resintall the package with:

 sudo apt install python3-pip

To confirm that everything works, run:

 pip3 -V

After this you can now use pip3 to manage any python package of your interest. Eg

pip3 install NumPy

2 Comments

This issue appeared for me after reinstall mysql server. The above, solved it.
Thanks, this answer really helped. I had same issue.
3

Writing the whole path/directory eg. (for windows) C:\Programs\Python\Python36-32\Scripts\pip3.exe install mypackage. This worked well for me when I had trouble with pip.

1 Comment

Thanks for your comments! But I'm not sure which directory I should write. I am relatively new to my Mac also...
3

In my case, although python3-pip was already installed, it didn't recognize pip3. After reinstalling with

sudo yum reinstall python3-pip

it worked fine and recognized pip3 commands.

Comments

2

its possible if you already have a python installed (pip) you could do a upgrade on mac by

brew upgrade python

Comments

1

Try this if other methods do not work:

  1. brew install python3
  2. brew link --overwrite python
  3. brew postinstall python3

Comments

0

After yum install python3-pip, check the name of the installed binary. e.g.

ll /usr/bin/pip*

On my CentOS 7, it is named as pip-3 instead of pip3.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.