Python – Unable to install pip using easy_install

Unable to install pip using easy_install… here is a solution to the problem.

Unable to install pip using easy_install

I’m trying to install pip:

$ sudo easy_install pip

This error occurs:

Searching for pip
Reading https://pypi.python.org/simple/pip/
Couldn't find index page for 'pip' (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 pip
error: Could not find suitable distribution for Requirement.parse('pip')

I’ve checked if python:: is installed

$ python --version
Python 2.7.10

This should work fine based on multiple threads, what am I doing wrong?

After downloading https://bootstrap.pypa.io/get-pip.py and running:

python get-pip.py

I’m getting this error :

Exception:
Traceback (most recent call last):
  File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/var/folders/1y/4bcsjv_97t3793jlxscvccb07rjdl6/T/tmpvjuB2G/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'

Solution

Why not follow the official documentation?

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

Then run the following:

$ python get-pip.py

from official doc of pip

and the actual link to get-pip.py

If you want to install a specific Python version on your machine
Python 2.7 or Python 3.x instead of Python.

Related Problems and Solutions