Thursday, November 20, 2008

Why I don't use easy_install

First things first, this post is not meant as a flame, nor should it indicate to you that you shouldn't use it, unless of course you're priorities are perfectly aligned with my own. That being said, here are the reasons why I don't use easy_install, and how I'd fix them.
  1. No easy_uninstall. Zed mentioned this in his PyCon '08 lightning talk, and it's still true. Yes I can simply remove these files, and yeah I could write a script to do it for me. But I shouldn't have to, if I can install packages, I should be able to uninstall packages, without doing any work.
  2. I can't update all of my currently installed packages. For any packages I don't have explicitly installed to a particular version(which to it's credit, easy_install makes very easy to do), it should be very to upgrade all of these, because I probably want to have them up to date, and I can always lock them at a specific version if I want.
  3. I don't want to have two package managers on my machine. I run Ubuntu, so I already have apt-get, which i find to be a really good system(and doesn't suffer from either of the aforementioned problems). Having two packages managers inherently brings additional confusion, if a package is available in both which do I install it from? It's an extra thing to remember to keep up to date(assuming #2 is fixed), and it's, in general, an extra thing to think about, every time I go to update anything on my machine.

So what's my solution? PyPi is a tremendous resource for Python libraries, and there are great tools in Python for working with it, for example using a setup.py file makes it incredibly easy to get your package up on PyPi, and keep it up to date. So there's no reason to throw all that stuff out the window. My solution would be for someone to set up a server that mirrored all the data from PyPi, regularly, and then offered the packages as .deb's(for Debian/Ubuntu users, and as RPMs for Fedora users, etc...). That way all a user of a given package manager can just add the URL to their sources list, and then install everything that's available from PyPi, plus they derive all of the benefits of their given package manager(for me personally, the ability to uninstall and batch upgrade).

Note: I'm not suggesting everyone use apt-get, I'm merely suggesting everyone use their native package manager, and there's no reason easy_install/pip/virtualenv can't also be used.

11 comments:

  1. Decent article Alex. I'd like to see your distribution package manager and/or your proposed method of dealing with your problem work with virtualenv or perhaps that really doesn't matter to you :D

    I simply love virtualenv and is the reason why I use easy_install/setuptools.

    I see your first couple of points valid and would like to hear more information from those responsible for writing easy_install/setuptools. Perhaps I need to go mailing list searching :)

    ReplyDelete
  2. Just as non-flame sidenotes:

    http://files.lunaryorn.de/view/code/easy_uninstall.py
    Pretty much does the job and shouldn't be to hard to extend if needed.

    http://tools.assembla.com/yolk/
    Brings a ton of useful things to look up PyPI metadata and includes the insanely useful ``yolk -U`` which lists outdated packages by querying the PyPI.

    ReplyDelete
  3. If apt-get covers the packages you need then I guess it shouldn't be an issue for you. :-)

    Personally I find easy_install invaluable, but like brosner I use it with virtualenv so not being able to uninstall is just not an issue (just blow away the virtual environment).

    ReplyDelete
  4. To suggest that everyone use apt-get is a bit myopic. Since I've been working with Python I've seen people complain about easy_install. There's a really easy solution to this: fix it! I agree that we don't need another distribution system, but it's a bit late for that now.

    The virtualenv situation that brosner spoke about is an important consideration. That said I agree we still need to fix uninstall.

    ReplyDelete
  5. I'm very much a fan of pip for package installation, and virtualenv for easy-to-blow-away Python environments. Though if you want to tell everyone to use a Linux package manager, you ought to be recommending RPM, since it's the one standardized in the FHS :)

    ReplyDelete
  6. You can use yolk ( http://tools.assembla.com/yolk/ ) to find updates to already installed packages.

    ReplyDelete
  7. Is there a way to integrate easy_install into apt? Like with checkinstall you can compile a .tar.gz and then install it as a .deb so that it's kept track of in apt.

    ReplyDelete
  8. Actually it turns out that checkinstall works with any command that modifies files, not just "make install", so it could theoretically work with easy_install, too. I haven't had much luck with this, but I'm not sure how to use it correctly, either.

    I have seen people using "checkinstall python setup.py install", though.

    Also:

    --record=FILENAME (New in 0.5a4)
    Write a record of all installed files to FILENAME. This is basically the same as the same option for the standard distutils "install" command, and is included for compatibility with tools that expect to pass this option to "setup.py install"

    ReplyDelete
  9. sudo checkinstall sudo easy_install yolk

    claims to work, but removing with

    dpkg -r yolk

    doesn't actually remove the egg. Then I found easy-deb:

    http://easy-deb.sourceforge.net/

    Looks like lots of half-baked options...

    ReplyDelete
  10. I agree on all points.

    Actually, setuptools should be taught to produce debs. It already has some support for rpms.

    ReplyDelete

Note: Only a member of this blog may post a comment.