Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

People have access to servers as normal users (jailed actually), and they're advised - at the moment - to download whatever python packages they need, build them, then add their location to sys.path.

Without virutalenv, is there a way to make easy_install and pip install packages to a directory (in $PYTHONPATH) inside of ~?

Alternatively, can you set up a virtualenv that is always active for a given user, both in the shell and with repsect to Apache and mod_wsgi?

In short, how do you best get around the permissions problem in installing site packages?

share|improve this question

To get virtualenv available in shell automatically you should source its bin/activate script every time the user logs in. You can do this along with creating default virtualenv environment when the user is created. Or you can just add path to the virtualenv's python interpreter to the $PATH variable right in the user's .bash_login, .zshrc or whatever else.

Virtualenv, when activated, modifies two environment variables. First, it will add {virtualenv}/bin to your $PATH, and second, it will define $VIRTUAL_ENV variable telling where exactly virtualenv is set up. So you may try to mimic its behavior in Apache by setting these variables. In the end you should use virtualenv's python interpreter downloaded with virtualenv which has all necessary paths set up.

mod_wsgi in its hand has some configuration options which can help you with this. It should be sufficient to use WSGIPythonPath. You might consider using WSGIPythonEggs as well.

However note that you should protect the initial setup from being modified by user but accessible by user running apache.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.