Search code examples
pythondebianvirtualenvpep

Virtualenv or PEP370


I have been recommended to follow PEP370 instead of creating virtualenvs.

http://legacy.python.org/dev/peps/pep-0370/

Can anyone explain which is a better solution? It seems virtualenvs are redundant since python 2.6.


Solution

  • From that PEP (emphasis added):

    Current Python versions don't have a unified way to install packages into the home directory of a user (except for Mac Framework builds). Users are either forced to ask the system administrator to install or update a package for them or to use one of the many workarounds like Virtual Python [1], Working Env [2] or Virtual Env [3].

    It's not the goal of the PEP to replace the tools or to implement isolated installations of Python. It only implements the most common use case of an additional site-packages directory for each user.

    PEP370 solves a similar but still different problem from virtualenv. PEP370 is about a per-user installation, but that doesn't solve the same problems as virtualenv, which creates environments independent of system or user. I suppose you could use PEP370 to replace virtualenv, but that would mean creating a new user account for every new environment you wanted and being very careful to never modify the base istallation, which isn't exactly an easy to use or maintain system.