I've just recently scratched a long standing itch I had: The need to
"freeze" an EGG distribution, along with all of its requirements, into a
single .py file that can be reinstalled at any time, even with *no* net

eggfreezer can be executed with a list of requirements and it will use
easy_install to satisfy them and then create a single .py file (which
bundles a tarball with all needed eggs) that when executed will
bootstrap a virtualenv and install them in there, again, with no need
for net access.

I think this can be very useful for frameworks which rely heavily in
eggs, like those I'm cross-posting to their lists,  because the lack of
something like this is perceived by many as a weakness of our install
process and of setuptools in general. In fact, the main motivation for
writing this was a discussion I had recently in python-es :) It doesn't
attempt to replace the current way of installing with easy_install, but
to provide a complementary wayfor those who have it hard to install eggs
from PyPI (or any index) due to sub-optimal network access.

It can be also very useful, at least it will be for me, for webapps or
whatever that might need to be re-deployed in the future when the
required versions of the dependencies might be old and hard to find
again (it has happened to me several times, probably all of us, and it

The usage is pretty straightforward:

eggfreezer -o AllTurbogears2 -f
http://turbogears.org/2.0/downloads/current TurboGears2 tg.devtools

That command will try to satisfy all dependencies for TurboGears2 and
tg.devtools (fetching them from local packages if available), using that
url to find links, and bundle them into a file called

When we execute that file we get:

$ python AllTurboGears2-py2.5-linux-i686.py
You must provide a DEST_DIR
Usage: AllTG2-py2.5-linux-i686.py [OPTIONS] DEST_DIR

  --version           show program's version number and exit
  -h, --help          show this help message and exit
  -v, --verbose       Increase verbosity
  -q, --quiet         Decrease verbosity
  --clear             Clear out the non-root install and start from scratch
  --no-site-packages  Don't give access to the global site-packages dir
to the
                      virtual environment
  --unzip-setuptools  Unzip Setuptools when installing it

Which should be familiar to anyone who has ever used virtualenv to
create a bootstrap script. If we pass the DEST_DIR it asks for as a
parameter it will create a virtualenv there and install all requirements
we specified when creating installer from an inline, compressed,
tarball. Without the need for net access. You can check out the results
(and give TG2 a try now that you're at it ;) with this sample I've created:


Unfortunately these are platform dependent at the moment. If anyone has
any idea of how the script could be improved to bundle several
platforms' binary eggs to create an "universal" installer please let me

Ah, EggFreezer itself is at PyPI. "easy_install EggFreezer" will get it
for you. It's MIT licensed.

I've tested it on linux i686 with python 2.4 and python2.5. I have no
idea if it works on other platforms, if it does, please let me know, if
it doesn't, please send me a fix :)
I've also created installers for TG1, TG2, Pylons, Rum and ToscaWidgets
as means of testing and it worked like a charm :)

Finally, I'd like to thank Ian for virtualenv, which is the real
weight-lifter here, and of course Philip and all of those who've created

Repoze-dev mailing list

Reply via email to