Why Use Pip Over Easy_Install

Why use pip over easy_install?

Many of the answers here are out of date for 2015 (although the initially accepted one from Daniel Roseman is not). Here's the current state of things:

  • Binary packages are now distributed as wheels (.whl files)—not just on PyPI, but in third-party repositories like Christoph Gohlke's Extension Packages for Windows. pip can handle wheels; easy_install cannot.
  • Virtual environments (which come built-in with 3.4, or can be added to 2.6+/3.1+ with virtualenv) have become a very important and prominent tool (and recommended in the official docs); they include pip out of the box, but don't even work properly with easy_install.
  • The distribute package that included easy_install is no longer maintained. Its improvements over setuptools got merged back into setuptools. Trying to install distribute will just install setuptools instead.
  • easy_install itself is only quasi-maintained.
  • All of the cases where pip used to be inferior to easy_install—installing from an unpacked source tree, from a DVCS repo, etc.—are long-gone; you can pip install ., pip install git+https://.
  • pip comes with the official Python 2.7 and 3.4+ packages from python.org, and a pip bootstrap is included by default if you build from source.
  • The various incomplete bits of documentation on installing, using, and building packages have been replaced by the Python Packaging User Guide. Python's own documentation on Installing Python Modules now defers to this user guide, and explicitly calls out pip as "the preferred installer program".
  • Other new features have been added to pip over the years that will never be in easy_install. For example, pip makes it easy to clone your site-packages by building a requirements file and then installing it with a single command on each side. Or to convert your requirements file to a local repo to use for in-house development. And so on.

The only good reason that I know of to use easy_install in 2015 is the special case of using Apple's pre-installed Python versions with OS X 10.5-10.8. Since 10.5, Apple has included easy_install, but as of 10.10 they still don't include pip. With 10.9+, you should still just use get-pip.py, but for 10.5-10.8, this has some problems, so it's easier to sudo easy_install pip. (In general, easy_install pip is a bad idea; it's only for OS X 10.5-10.8 that you want to do this.) Also, 10.5-10.8 include readline in a way that easy_install knows how to kludge around but pip doesn't, so you also want to sudo easy_install readline if you want to upgrade that.

Can I use `pip` instead of `easy_install` for `python setup.py install` dependency resolution?

Yes you can. You can install a package from a tarball or a folder, on the web or your computer. For example:

Install from tarball on web

pip install https://pypi.python.org/packages/source/r/requests/requests-2.3.0.tar.gz

Install from local tarball

wget https://pypi.python.org/packages/source/r/requests/requests-2.3.0.tar.gz
pip install requests-2.3.0.tar.gz

Install from local folder

tar -zxvf requests-2.3.0.tar.gz
cd requests-2.3.0
pip install .

You can delete the requests-2.3.0 folder.

Install from local folder (editable mode)

pip install -e .

This installs the package in editable mode. Any changes you make to the code will immediately apply across the system. This is useful if you are the package developer and want to test changes. It also means you can't delete the folder without breaking the install.

Can setup.py use pip rather than easy_install?

Why does setup.py behave differently when run under pip than when I directly invoke it?

PIP_INDEX_URL environment variable is a pip feature.

Your setup.py file uses setuptools which does not know about PIP_INDEX_URL.

I would suggest using:

PIP_INDEX_URL=http://yourpypi/ pip install .

instead of

python setup.py install

Why isn't pip or easy_install working?

You need to add easy_install/pip to the system path (assuming that you use Windows). These execs are usually located in: C:\Python27\Scripts. If they are not there you need to install them. Refer to these tips for pip: How do I install pip on Windows?

Using pip and easy_install: anyway “UnicodeDecodeError”

see hugleecool's answer to the question 'ascii' codec can't decode error when use pip to install uwsgi

to add some lines above to the

'default_encoding = sys.getdefaultencoding()' 

in file

'C:\Python27\Lib\ mimetypes.py'

the lines are:

if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
default_encoding = sys.getdefaultencoding()

problem solved.

Decide which python version to use for pip and easy_install

One way would be:

  1. Open pip/easy_install in text editor

  2. Check top line, it should say

    #! /usr/bin/python

  3. Change it to #!path/to/python2.7

Python package install using pip or easy_install from repos

Using pip this is quite easy. For instance:

pip install -e hg+http://bitbucket.org/andrewgodwin/south/#egg=South

Pip will automatically clone the source repo and run "setup.py develop" for you to install it into your environment (which hopefully is a virtualenv). Git, Subversion, Bazaar and Mercurial are all supported.

You can also then run "pip freeze" and it will output a list of your currently-installed packages with their exact versions (including, for develop-installs, the exact revision from the VCS). You can put this straight into a requirements file and later run

pip install -r requirements.txt

to install that same set of packages at the exact same versions.

trouble with pip and easy_install to install python packages

You should upgrade your pip to version 6.0, the .whl file you're using isn't compatible with earlier versions.

To bump up your pip version on Windows :
python -m pip install -U pip

Pip/Easy_install do not install desired package

Since the "python -m pip install -U pip" actually displayed something, on a hunch I tried:

"python -m pip install requests"

This worked! I don't know why any of the installation guides do not say to do this.



Related Topics



Leave a reply



Submit