Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I'm looking for a good way to package a Python application that is going to be deployed on a Debian server.

The application itself depends on some modules which are not included in base Debian repository, although they might be in the future. This creates some problems... I depend on some patches to those modules. If the original module gets installed one day, the application will break. However if I install everything I need in a virtualenv just for that application, I lose the ability to upgrade Python itself (in case of security updates).

The third option would be to rename my fork of the upstream module and just treat it as a completely separate one. But that would mean changing the code (not much work, but it wouldn't be that clean / universal anymore).

Are there any other options that I missed? Are there any pros / cons I didn't see in the solutions above?

share|improve this question

Try installing your custom modules into a different location (outside of the normal sys.path location) and then adding the new install location to your $PYTHONPATH.

This may avoid the problem that could arise if the upstream version of your patched modules is installed, thus breaking your system.

share|improve this answer

A virtualenv will still get python upgrades; the standard library and interpreter are both symlinked. You do have to worry about upgrades to the python modules installed into the virtualenv, including ones that could have been shipped by the distro. So I recommend making your own packages for the customized modules and letting the app break if the original module gets a security update.

share|improve this answer
"the standard library and interpreter are both symlinked" -> not true. Libs are symlinked unless "--no-site-packages" is specified. The interpreter is a copy. (at least as of virtualenv 1.4.9) – viraptor Nov 15 '10 at 1:01
You're correct about the interpreter. The standard libs are symlinked though. IIRC --no-site-packages changes the way sys.path is manipulated. – Tobu Nov 15 '10 at 7:05

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.