Friday, November 26, 2010

Getting Started with a Virtual Python Installation

Working with and developing Python software is complicated by several factors:
  • Many users do not have the administrative privileges that are needed to install packages in the Python site packages directory, where Python packages are most easily installed
  • Python developers often need to manage many Python projects in the same development environment
The Python virtualenv package resolves these issues by allowing users to generate a local Python installation. Thus, a user can create a Python installation into which they can install Python packages using standard tools like easy_install and pip.

Unfortunately, getting started with virtualenv is complicated by the fact that you need to install this package to create virtual Python installations. But, if you do not have administrative privileges, then you are stuck. This is the simplest process that I have seen:
hg clone http://bitbucket.org/ianb/virtualenv
virtualenv/virtualenv.py ENV
Unfortunately, the hg command may not be preinstalled on your machine. It is not available on any of mine...

The pyutilib.virtualenv package contains the vpy_install script, which can bootstrap the setup of virtualenv. This script extends the functionality of the virtualenv driver script to allow direct, and it customization of this initial environment. The vpy_install script can be easily downloaded from the PyUtilib wiki, or it can be downloaded with commands like wget or curl:
wget http://doiop.com/pyutilib/vpy_install
vpy_install ENV

No comments:

Post a Comment