[Server-devel] [XSCE] Install python applications in a virtualenv without system wide packages using wheel binary package format

Miguel González migonzalvar at activitycentral.com
Mon Dec 16 11:17:22 EST 2013

I want to share with you my proposed approach to install Python web
application in XSCE.

The idea is to install them into a Python virtual environment isolated
from the system wide packages installed.

If you are not familiar with Python virtualenvs, it's just a similar
concept than a chroot.  It creates a new folder structure and makes
symlinks to Python executable and libraries.  It also disables system
site-packages allowing to install different ones.  To use the
environment it must be activated.

Some advantages to this approach are:

- **Isolated dependencies**.  Each application can have its own
requirements, for example two applications can have different Django
versions.  Also it allows a clean remove procedure because modules and
application source code are in the same dir.

- It is a **standard solution** described in PEP 405 [1].  There are
available great tools with excellent support.  For example, pip and
pip's ansible module support virtualenvs.

As disadvantages:

- This approach uses **more space in disk** as site packages are
installed once per application.  For example Django 1.4.5 uses 45MB.

- **rpm packages can't be used** to install Python packages in a
virtualenv.  That would require to compile binary packages.  That
means more time and, more annoying, the system would need development

I have nothing to say about disk space but, to counteract the
compilation problem I propose to use the wheel binary package format

The tradeoff is that we would need to provide those packages so
compiling the packages for every library and every architecture.

My test has succeed with pathagar so far.  I have written recipes to
create wheel packages [4] and to deploy a web application in a XSCE
using them [5]. I've even created a wheels repository with ARM
packages for psycopg2 and SQLAlchemy [6].

if you have any doubts, concerns, comments, please share them with me,
I'd really appreciate any kind of feedback.


[1] http://www.python.org/dev/peps/pep-0405/

[2] http://wheel.readthedocs.org/en/latest/

[3] http://www.python.org/dev/peps/pep-0427/

[4] http://migonzalvar.eu/pip-installing-using-wheels.html

[5] http://migonzalvar.eu/deploying-a-web-application-into-a-virtualenv-using-wheel-packages.html

[6] http://xsce.activitycentral.com/wheelhouse/

Miguel González
Activity Central: http://www.activitycentral.com

More information about the Server-devel mailing list