Ian Bicking: the old part of his blog

Alternate Python Install Directory

So, I started experimenting with setting up an alternate location for installing files. Using FreeBSD, all libraries go into /usr/local/lib/pythonX.Y/site-packages by default (no /usr/lib/pythonX.Y). That includes packages installed by ports (FreeBSD's packaging system).

But we're creating an alternate hierarchy for our systems, and I've started thinking this should include multi-version software installation (things installed through a packaging system will still go wherever the packager wants them to go). Eggs don't map terribly well to most packaging systems, as packaging systems don't support multiple versions and "active" versions of software well. Eggs do support these things, and moreso these features are really important to the way we deploy software.

So it wasn't too hard... first, I made /usr/local/lib/python2.4/site-packages/sitecustomize.py, that looks like:

import site
import sys

                % (sys.version_info[0], sys.version_info[1]))

Then I created a file /usr/local/lib/python2.4/distutils/distutils.cfg:

prefix = /iscape

find_links = http://host.name/package_archive/
install_dir = /iscape/lib/python%(version)s/site-packages
site_dirs = /iscape/lib/python%(version)s/site-packages

Substituting %(version)s with the respective Python version, of course (though we're primarily using 2.4, especially for our own software).

Now I can install our internal packages to a directory /package_archive/ (and just let Apache create the HTML index of that directory), and easy_install.py PackageName will install into /iscape/lib/.

Especially until such time as easy_install.py (or probably another to-be-written tool called nest) does package management (listing and deleting installed versions of software) this will keep all our eggs together and easy to manage.

Created 14 Sep '05


See also these non-root installation instructions that show how to install packages so that they override the systemwide Python site-packages directory, even if you don't have root access.

# Phillip J. Eby

I've just downloaded my pyvm-1.5.2 on sourceforge. Pyvm is a wannabe-java jvm but for python. It installs cleanly everywhere in the file system and doesn'r require root access. If you'd like to have a try that is on http://pyvm.sourceforge.net. It should recompile from sources on SuSE 9.3 (there is already the binary) and Fedora core3, but, if all the dependencies are meet, on any system.

PS> I've just downloaded on sourceforge the release 1.5.2, but the mirrors can be not up-todate.

# antonio