947

A tweet reads:

Don't use easy_install, unless you like stabbing yourself in the face. Use pip.

Why use pip over easy_install? Doesn't the fault lie with PyPI and package authors mostly? If an author uploads crap source tarball (eg: missing files, no setup.py) to PyPI, then both pip and easy_install will fail. Other than cosmetic differences, why do Python people (like in the above tweet) seem to strongly favor pip over easy_install?

(Let's assume that we're talking about easy_install from the Distribute package, that is maintained by the community)

KarSho
  • 5,478
  • 13
  • 41
  • 75
Sridhar Ratnakumar
  • 68,948
  • 61
  • 139
  • 172
  • 74
    Before I saw this question I answered an unrelated one by saying "don't use easy_install, use pip". Now I'm wondering why I said that... – Daniel Roseman Jul 10 '10 at 19:07
  • 21
    I still run into packages that cause pip to fail but easy_install handles just fine, so I'm curious about this as well. – kwatford Jul 11 '10 at 01:03
  • 5
    pyobjc-core is an example of a package that works with easy_install but not with pip. – Marc Abramowitz Apr 14 '11 at 21:16
  • 5
    Coming back to python four years later the state of packaging is beyond messed up. It's 2014 and it only got worse. From what I understand setuptools [absorbed](http://pythonhosted.org/setuptools/merge-faq.html#why-setuptools-and-not-distribute-or-another-name) distutils, even though official python docs are [oblivious](https://docs.python.org/2/distutils/introduction.html) to this, but neither is [going to be part of python 3](https://python-packaging-user-guide.readthedocs.org/en/latest/future.html), and pip is hanging around like a third wheel (pun intended). – Andriy Drozdyuk Jun 02 '14 at 15:52
  • Does pip support user home directory installs at all? – Pavel Šimerda Jun 17 '14 at 06:58
  • @PavelŠimerda yes, with the --user flag – Andy Casey Oct 02 '14 at 21:12
  • 3
    @drozzy: You happened to come back at the worst possible time—right after a group of core devs decided things had become such a mess that they had to get involved in solving the problem. `setuptools` isn't part of Python 3 because `pip` is, and that's the only part end-users need. (And developers who want to distribute on PyPI can obviously `pip install setuptools`, and everything else they might want.) – abarnert May 23 '15 at 03:19
  • 2
    Could we re-open this? This question has generated a really useful, objective, fact-based answer, and in the future, the facts may change, and I would love for people to be able to contribute an even more useful, more up-to-date answer. – Flimm Apr 06 '18 at 07:11

9 Answers9

600

From Ian Bicking's own introduction to pip:

pip was originally written to improve on easy_install in the following ways

  • All packages are downloaded before installation. Partially-completed installation doesn’t occur as a result.
  • Care is taken to present useful output on the console.
  • The reasons for actions are kept track of. For instance, if a package is being installed, pip keeps track of why that package was required.
  • Error messages should be useful.
  • The code is relatively concise and cohesive, making it easier to use programmatically.
  • Packages don’t have to be installed as egg archives, they can be installed flat (while keeping the egg metadata).
  • Native support for other version control systems (Git, Mercurial and Bazaar)
  • Uninstallation of packages.
  • Simple to define fixed sets of requirements and reliably reproduce a set of packages.
Community
  • 1
  • 1
Daniel Roseman
  • 541,889
  • 55
  • 754
  • 786
  • 63
    The "error messages" advantage is huge, especially for newer users. Easy-install is famous for spitting out dozens of what look like fatal errors, only to have wound up doing the install successfully anyway, which makes it difficult to use until you learn to ignore most everything it says. Pip simply omits saying those things in the first place. – Brandon Rhodes Oct 06 '10 at 20:47
  • 1
    @Glyph is there an advantage using `easy_install pip` over `sudo apt-get install python-pip`? – Dennis Jun 07 '12 at 11:38
  • 1
    @Dennis: easy_install usually installs the more recent version compared to apt-get. – BastiBen Jun 28 '12 at 11:10
  • 2
    Do not use easy_install outside of a virtualenv on package-based distributions: http://workaround.org/easy-install-debian – Federico Jul 08 '12 at 14:25
  • 11
    @Dennis: When using `sudo apt-get` Ubuntu/Debian will install Python packages in `/usr/lib/python/dist-packages` whereas `sudo pip` or `sudo easy_install` will install in `/local/lib/python/site-packages` and unfortunately the Debian/Ubuntu packages often have different names that pip isn't familiar with. The best solution IMHO is to use virtualenv and `pip` intall your packages there. – Mark Mikofski Aug 24 '12 at 17:47
  • 2
    This needs an update. – Andriy Drozdyuk Jun 02 '14 at 15:39
  • UPDATE (repeating user3341691 answer): setuptools has absorbed distribute as opposed to the other way around, as some thought. setuptools is up-to-date with the latest distutils changes and the wheel format. Hence, easy_install and pip are more or less on equal footing now. Source: http://pythonhosted.org/setuptools/merge-faq.html#why-setuptools-and-not-distribute-or-another-name – A.Sommerh Oct 29 '14 at 14:07
  • 1
    And here we are many years since these goals have been announced and none of them hadn't been reached. Yes, `easy_install` was garbage, but so is `pip`. Nothing really changed except some superficial things. – wvxvw Dec 03 '18 at 12:37
313

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.

Community
  • 1
  • 1
abarnert
  • 313,628
  • 35
  • 508
  • 596
  • 9
    @drozzy: Maybe. But consider that in another 5 years, my answer will be as out of date as all the others, while Daniel Roseman's is timeless. Also, my answer wouldn't be as good if it couldn't rely on pointing at a 5-year-old accepted answer that demonstrates _why_ the Python community got behind `pip` in the intervening time. – abarnert May 26 '15 at 00:44
  • 2
    It's worth noting that some packaged versions of pip were buggy, and pip failed to upgrade itself. Whether you consider it ironic or not, in those cases the easiest solution is to do `easy_install -U pip` or `easy_install3 -U pip`. – analytik Jul 28 '16 at 09:43
  • "but don't even work properly with `easy_install`" This was not my experience, although I haven't tried in a while since wheels now dominate. But Christoph Gohlke's binaries used to be distributed as executable eggs. Calling `easy_install` on them was the *only* way I could get those packages installed to a virtual environment, and it never gave me any heartburn. In what way does `easy_install` no longer work with virtual envs? – jpmc26 May 10 '18 at 11:44
247

Another—as of yet unmentioned—reason for favoring pip is because it is the new hotness and will continue to be used in the future.

The infographic below—from the Current State of Packaging section in the The Hitchhiker's Guide to Packaging v1.0—shows that setuptools/easy_install will go away in the future.

enter image description here

Here's another infographic from distribute's documentation showing that Setuptools and easy_install will be replaced by the new hotness—distribute and pip. While pip is still the new hotness, Distribute merged with Setuptools in 2013 with the release of Setuptools v0.7.

enter image description here

Nick T
  • 22,202
  • 10
  • 72
  • 110
Matthew Rankin
  • 400,554
  • 38
  • 116
  • 156
  • 47
    Infographics FTW – WineSoaked Mar 19 '11 at 17:00
  • 35
    OTOH, the second graphic has been outdated for a year. distribute will reach end-of-life and be superseded by distutils2 (which will also be in the Python standard library starting with 3.3). A basic installer named pysetup is provided as part or distutils2, and pip will continue to provide additional features on top of distutils2 in the future. – Éric Araujo Oct 10 '11 at 14:58
  • 7
    omg thank you so much. i have been confused by python packaging for years and it is heartening to see a semi-authoritative path forward. – aaron Dec 28 '11 at 05:36
  • 3
    @ÉricAraujo the second graphic is not outdated yet. It will be in the *future*, when distutils2 has actually been implemented, but that has not happened yet. – Glyph Mar 25 '12 at 09:46
  • 1
    distutils2 is still in alpha stage – Kugel Jul 29 '12 at 17:32
  • 1
    Died laughing. If this answer is merged with the text of the other answer, it should *totally* be the one true answer. – Epu Aug 24 '12 at 21:48
  • 2
    FINALLY! I wish other domain experts would produce graphics like this. Everytime I enter a new software ecosystem, I spend days trying to figure out what tools and packages are obsolete, which are preferred, which are complements to each other vs competitors, how functionality overlaps, etc. – odigity Feb 01 '13 at 18:05
  • 62
    As of March 2013 [`distribute` is merging back with `setuptools`](http://mail.python.org/pipermail/distutils-sig/2013-March/020126.html). `pip` works. [`packaging` (`distutils2`) is *not* included in Python 3.3](https://distlib.readthedocs.org/en/latest/overview.html#what-was-the-problem-with-packaging). – jfs Apr 29 '13 at 01:11
  • 21
    This "answer" is so out of date and just wrong it's not even funny. – onlynone Sep 24 '14 at 16:13
171

Two reasons, there may be more:

  1. pip provides an uninstall command

  2. if an installation fails in the middle, pip will leave you in a clean state.

Ned Batchelder
  • 323,515
  • 67
  • 518
  • 625
115

REQUIREMENTS files.

Seriously, I use this in conjunction with virtualenv every day.


QUICK DEPENDENCY MANAGEMENT TUTORIAL, FOLKS

Requirements files allow you to create a snapshot of all packages that have been installed through pip. By encapsulating those packages in a virtualenvironment, you can have your codebase work off a very specific set of packages and share that codebase with others.

From Heroku's documentation https://devcenter.heroku.com/articles/python

You create a virtual environment, and set your shell to use it. (bash/*nix instructions)

virtualenv env
source env/bin/activate

Now all python scripts run with this shell will use this environment's packages and configuration. Now you can install a package locally to this environment without needing to install it globally on your machine.

pip install flask

Now you can dump the info about which packages are installed with

pip freeze > requirements.txt

If you checked that file into version control, when someone else gets your code, they can setup their own virtual environment and install all the dependencies with:

pip install -r requirements.txt

Any time you can automate tedium like this is awesome.

Matthew Schinckel
  • 32,344
  • 6
  • 71
  • 109
  • 1
    This seems to be part of setuptools now as well: http://pythonhosted.org/setuptools/setuptools.html#declaring-dependencies – Andriy Drozdyuk Jun 02 '14 at 15:43
  • you should use `pipreqs` to obtain the requirements.txt file. It will give only the libraries related to the project where you are calling pipreqs, so that requirements.txt will be based on the project and not on the virtualenv. – SeF May 29 '19 at 15:32
82

pip won't install binary packages and isn't well tested on Windows.

As Windows doesn't come with a compiler by default pip often can't be used there. easy_install can install binary packages for Windows.

fuzzyman
  • 7,810
  • 2
  • 28
  • 32
  • 3
    Interesting, I never thought of that. pip also doesn't support the setuptools "extras" features that is used by the Zope folks at least. – Sridhar Ratnakumar Jul 11 '10 at 18:22
  • 1
    Is that an indication of needing a gcc environment on windows, rather than insisting pip installs pre-built binaries? – WineSoaked Mar 19 '11 at 17:01
  • 18
    The "right" compiler to use for Windows is Visual Studio (2008 i believe for recent versions of Python). Installing this, even the free version, is a hassle. The *normal* way of installing C extensions on Windows is from pre-compiled binaries. easy_install supports this, pip doesn't. – fuzzyman Mar 23 '11 at 10:59
  • 1
    You can use gcc on Windows through mingw32 and configuring distutils to use it. Because of the C runtime mismatch not everything will work with this (file descriptors will be different for example). – fuzzyman Mar 23 '11 at 11:01
  • 8
    This is the primary reasons why I still use easy_install. – Randy Syring Jan 12 '12 at 19:05
  • 1
    Exactly. There should be a new SO question: "Why use easy_install over pip ... on windows". For example, just got through hooking up another computer to nltk (which at least depends on numpy if not others) and this doesn't work too well for the Windows pip. – demongolem May 31 '12 at 21:24
  • 1
    pip + VS2008 work pretty well together... always better to be able to compile from source anyway because all libraries do definitely not provide binaries for every platforms, which is a pain when you have to setup an automated deployment plan for your stuff, unless you use pure-python only libs or sources... VS2008 is pretty straightforward to install, it's free (like in "free beer") and this is definitely the most standard way to compile C natively under Windows – cedbeu Mar 30 '13 at 22:05
  • 14
    In the years since the above answer was given, it's now no longer true that pip can't install binary packages, on Windows or on other platforms. The `wheel` binary distribution format makes that possible. Many third-party packages with C extension modules are now also being distributed as wheels built for various platforms and pip can automatically install them. See, for instance, http://pythonwheels.com – Ned Deily Sep 03 '14 at 19:22
76

UPDATE: setuptools has absorbed distribute as opposed to the other way around, as some thought. setuptools is up-to-date with the latest distutils changes and the wheel format. Hence, easy_install and pip are more or less on equal footing now.

Source: http://pythonhosted.org/setuptools/merge-faq.html#why-setuptools-and-not-distribute-or-another-name

user3341691
  • 919
  • 6
  • 3
  • 5
    Why isn't this upvoted more? The answers are so outdated! – Andriy Drozdyuk Jun 02 '14 at 15:38
  • 5
    yeah, the top answers are extreamly outdated – WKordos Jul 25 '14 at 14:21
  • 2
    *Hence, easy_install and pip are more or less on equal footing now* This is nonsense. `easy_install` still is what it's been for a long time and pip improves upon it tremendously. `easy_install` is just part of `setuptools` and arguably one of the worst ones which is why pip aims to replace it. – Piotr Dobrogost Sep 28 '15 at 11:56
25

As an addition to fuzzyman's reply:

pip won't install binary packages and isn't well tested on Windows.

As Windows doesn't come with a compiler by default pip often can't be used there. easy_install can install binary packages for Windows.

Here is a trick on Windows:

  • you can use easy_install <package> to install binary packages to avoid building a binary

  • you can use pip uninstall <package> even if you used easy_install.

This is just a work-around that works for me on windows. Actually I always use pip if no binaries are involved.

See the current pip doku: http://www.pip-installer.org/en/latest/other-tools.html#pip-compared-to-easy-install

I will ask on the mailing list what is planned for that.

Here is the latest update:

The new supported way to install binaries is going to be wheel! It is not yet in the standard, but almost. Current version is still an alpha: 1.0.0a1

https://pypi.python.org/pypi/wheel

http://wheel.readthedocs.org/en/latest/

I will test wheel by creating an OS X installer for PySide using wheel instead of eggs. Will get back and report about this.

cheers - Chris

A quick update:

The transition to wheel is almost over. Most packages are supporting wheel.

I promised to build wheels for PySide, and I did that last summer. Works great!

HINT: A few developers failed so far to support the wheel format, simply because they forget to replace distutils by setuptools. Often, it is easy to convert such packages by replacing this single word in setup.py.

Christian Tismer
  • 1,136
  • 12
  • 16
  • 2
    updated above - I think the waiting is almost over ;-) – Christian Tismer Apr 28 '13 at 00:06
  • I should update this, again, because wheel has become the standard in spring 2014. Actually, I think such old threads should not be changed ad infinitum, because - the old answers were quite good - it is easy to replace everything when reality changes. But is it fair, when the original reason for a question is gone? – Christian Tismer Jan 13 '15 at 18:50
3

Just met one special case that I had to use easy_install instead of pip, or I have to pull the source codes directly.

For the package GitPython, the version in pip is too old, which is 0.1.7, while the one from easy_install is the latest which is 0.3.2.rc1.

I'm using Python 2.7.8. I'm not sure about the underlay mechanism of easy_install and pip, but at least the versions of some packages may be different from each other, and sometimes easy_install is the one with newer version.

easy_install GitPython
Landys
  • 5,899
  • 3
  • 21
  • 31
  • 6
    I checked this right now (see time stamp), and it is no longer true: Both pip and easy_install worked the same, resulting in GitPython 0.3.5 today. (Tested on OS X Yosemite, only). What is your platform? Please update your entry because it is now misleading. – Christian Tismer Jan 18 '15 at 20:06
  • In my pc, I cannot use PIP because no matter what setting attempted, it still throws network error regarding proxy. I don't have any issue with easy_install – RAY Mar 10 '21 at 04:29