How to hack your Zope 2 instance so that you can install Python packages using easy_install
This How-to applies to:
Any version.
This How-to is intended for:
Server Administrators
This HOWTO guides you through the few steps required to make your Zope 2 instance on Unix/Linux/Mac OSX a full-blown Python environment where you can install Python packages without administrator rights, using the convenient EasyInstall tool.
All literal blocks in this HOWTO are meant to be entered into a shell command line, the $ indicates the prompt.
Let's assume your Zope instance lives here:
$ INSTANCE_HOME=/var/lib/zope/myinstance
You need to get workingenv, and make your instance a working environment:
$ easy_install workingenv.py
$ workingenv $INSTANCE_HOME --home
Add a line just before the last line in the files $INSTANCE_HOME/bin/zopectl and $INSTANCE_HOME/bin/runzope, so that the last two lines read something like:
. $INSTANCE_HOME/bin/activate
exec "$PYTHON" "$ZDCTL" -C "$CONFIG_FILE" "$@"
Make sure you do this in both zopectl and runzope! Now whenever Zope restarts, it will use our new Python environment.
You can now easy install packages into your Zope instance:
$ . $INSTANCE_HOME/bin/activate
$ easy_install elementtree
This example will download and install elementtree into your Zope
instance. You can also download and install packages using the usual python setup.py install and they'll install only in your Zope's environment.
Whenever you want to deactivate your Python environment, type
$ deactivate