2

I am following instructions from http://www.leighsheneman.com/2014519easy-python-setup-for-a-mac/ to setup my mac for a development environment. I have successfully installed Python 2 and Python 3 via Homebrew, and after some steps to install related packages like SciPy, I get to the point of installing pip. Pip for Python 2.x installs perfectly with no trouble, via the command sudo easy_install pip. When it comes to pip for Python 3, I tried the command sudo easy_install pip3 as mentioned in the document I am following, and receive this error:

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 working download links found for pip3
error: Could not find suitable distribution for Requirement.parse('pip3')

What could be the problem in this case?

6
  • 1
    If you are using Python 3.4 or above I think it is pre-installed. Can you just check that? Commented Mar 17, 2017 at 20:24
  • The article you posted it completely off tracking and partially wrong. Recommend follow another tutorial Commented Mar 17, 2017 at 20:53
  • @Gugas: You are right, I just checked which pip3 and it showed /usr/local/bin/pip3 Commented Mar 17, 2017 at 22:18
  • @abccd: Thank you, I suspect as much after reading the comments here. Would you recommend another resource that might be correct? Commented Mar 17, 2017 at 22:19
  • The truth is that I couldn't seem to find a tutorial that I actually liked.... D: Anyways, I suspected that your question is already solved. But if I'm not mistaken, homebrew installs only Python 3.4 not the latest 3.6, would recommend reinstalling via python.org Commented Mar 17, 2017 at 22:28

5 Answers 5

2

Homebrew installs pip for you when you install Python. brew install python3 would have installed Python 3.6.0, and also pip3. You can then type pip3 in the terminal to run pip for Python 3. You don't need to use easy_install at all.

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

Comments

2

Following the official Documentation it says :

To install pip, securely download get-pip.py :

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Then run the following:

python get-pip.py

OR

python3 get-pip.py

Comments

1

The article you posted is plain wrong stating that you can install the pip3 package. (If you check it out, you'll see that it tries to resolve https://pypi.python.org/simple/pip3/, which doesn't exist.)

Installing pip for a specific environment is done by executing the script (in this instance, easy_install) in the context of that specific python environment.

Right now, your easy_install script is running using your python2 environment.

When you install two python environments, the easy_install script will be defaulting to one of them. In the background, there are actually two easy_install scripts for you. One, easy_install-2.x and one easy_install-3.x, x being the relevant minor version.

So to install pip using the python3 easy_install, just run:

$ sudo easy_install-3.x pip

Or, alternatively, just run the easy_install script using python3:

$ sudo python3 $(which easy_install) pip

Regardless of that, I think you would be better off using the get-pip.py (https://bootstrap.pypa.io/get-pip.py) script instead which would make your life easier.

Comments

0

You should already have pip2 and pip3 if you used homebrew to install python2.x and python3.x. Try running pip3 -V in the terminal and see if it works. You can use pip3 install package-name to install python3 packages and pip2 install package-name to install python2 packages.

Run which pip to see the default default path.

6 Comments

That's misleading (or plain incorrect). There is no pip2 and pip3 package managers. There is only pip installed in the context of a specific python environment.
@nir0s If you only have one version of python in the environment, then you're right. But what if you have two versions of python in the same environment? Will you not need both the package managers?
@nir0s I could be wrong. Could you please give an explanation as to how <code>pip</code> works when you have two python versions in the same environment?
There are no pip2 and pip3 packages in pypi. pip2 and pip3 are links to pip in the relevant python environment. You can't "install pip2". You can only "install pip in python2"
My previous comment was misleading. They area not "links". They are scripts with a shebang pointing to the relevant python executable (e.g. #!/usr/bin/python2).
|
0

The official instructions if you have Python but no pip are here: https://pip.pypa.io/en/latest/installing/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.