How to install Distribute—a framework for managing Python packages
First, let us have a look at some background on Distribute. According to the Distribute website (http://packages.python.org/distribute/), Distribute is:
"… intended to replace Setuptools as the standard method for working with Python module distributions."
According to the setuptools website (http://peak.telecommunity.com/DevCenter/setuptools), setuptools is:
"… a collection of enhancements to the Python distutils (for Python 2.3.5 and up on most platforms; 64-bit platforms require a minimum of Python 2.4) that allow you to more easily build and distribute Python packages, especially ones that have dependencies on other packages."
Among other things, Distribute facilitates the easy installation of Python packages from the Python Package Index (PyPI) page on http://pypi.python.org.
The Distribute authors (also known as the Fellowship of the Packaging) enthusiastically recommend you choose Distribute over setuptools with this propaganda from their website (http://packages.python.org/distribute/):
In addition to fixing setuptools, the Fellowship of the Packaging plan to fix the core package management libraries in Python.
These two frameworks are built on top of the Distutils (http://docs.python.org/library/distutils.html) library, which is part of the Python core, and is distributed with Python.
In order to fix things properly, fixes must be applied at the Distutils level.
Fortunately, all the hard work done in Distutils, setuptools, and Distribute over the years will end up in a new library called Distutils 2.
If you are interested in the future of Python packaging, the following diagram (http://guide.python-distribute.org/introduction.html#current-state-of-packaging) may help explain the status quo:
This diagram suggests we use the Distribute add-on library until Distutils 2 is released as part of the core library (which is months away, as of May 2010).
And now we shall install Distribute.
Installing Distribute on Mac OS X
While the curl program is recommended by the Distribute propaganda, it is not pre-installed with Mac OS X.
You can use Safari instead.
Download distribute_setup.py
To download the Distribute installer using Safari:
Browse to http://python-distribute.org.
Click on distribute_setup.py.
Select File | Save as and save it as
distribute_setup.py
.
Execute distribute_setup.py
To install Distribute, open Finder | Applications | Utilities | Terminal, change the directories to wherever you saved the file, and then type:
$ sudo python distribute_setup.py
If prompted, type your Mac OS X user account password.
You should see:
Verify that Distribute works
To verify that Distribute works, open Finder | Applications | Utilities | Terminal and type:
$ easy_install
You should see:
This means Distribute is installed and working.
We have just finished demonstrating how to install and test Distribute on Mac OS X.
Installing Distribute on Windows 7
The curl program does not ship with Windows, but you can use Internet Explorer instead.
Download distribute_setup.py
To download the Distribute installer with Internet Explorer:
Browse to http://python-distribute.org.
Right-click on distribute_setup.py.
Select Save Target As and save it as
distribute_setup.py
.
Execute distribute_setup.py
To install Distribute, select Start | All Programs | Accessories | Command Prompt and type:
$ python distribute_setup.py
You should see:
Verify that Distribute works
To verify that Distribute works, select Start | All Programs | Accessories | Command Prompt and type:
> easy_install
You should see:
This means Distribute is installed and is working.
We have just finished demonstrating how to install and test Distribute on Windows.
Installing Distribute on Ubuntu Linux
Ubuntu Linux does not come with the curl program pre-installed, but you can install it with:
$ sudo aptitude install curl
If you are prompted for a password, type your Ubuntu Linux account password.
Download distribute_setup.py
To download the Distribute installer, open Applications | Accessories | Terminal and type:
$ curl –O http://python-distribute.org/distribute_setup.py
Execute distribute_setup.py
To install Distribute, type:
$ python distribute_setup.py
You should see:
Verify that Distribute works
To verify that Distribute works, type:
$ sudo easy_install
You should see:
This means that Distribute is installed and working.
We have just finished demonstrating how to install and test Distribute on Ubuntu Linux.
Distribute comes with the easy_install program which you can use to install packages from the Python Package Index (http://pypi.python.org) with commands like:
$ easy_install package
Unfortunately, easy_install lacks critical features such as the ability to uninstall packages.
Fortunately, PIP (http://pip.openplans.org/) includes this feature, and more.