Using Python packages that are not included within the CIAO distribution is straightforward.  The key is that you need to use the CIAO python executable to install those packages into a location where CIAO python will find them.  In general the CIAO python will NOT find packages that are included in your system python installation -- these two are distinct and you must use one or the other.  Fortunately there is a common ground where a user can install packages that can be seen by both the system python and the CIAO python.  This is the $HOME/.local directory tree. 

The following shows step-by-step how to install the necessary packages in order to easily install packages for use within CIAO and Sherpa. 

Get into CIAO environment

First initialize the CIAO environment in the usual way:

% source <ciao_root>/bin/ciao.csh  # csh
% . <ciao_root>/bin/ciao.sh  # sh

Install the distribute / setuptools module and easy_install

% curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz
% tar -xzvf distribute-0.6.14.tar.gz
% cd distribute-0.6.14
% python setup.py install --user

Install external packages from PyPI

Now you are ready to install the external packages you want.  Often these packages are available on PyPI and can be installed with a single command:

% python ~/.local/bin/easy_install --user <python_package>

The --user flag is what instructs easy_install to install the package in your ~/.local area.  As a specific example:

% python ~/.local/bin/easy_install --user asciitable

Install packages from source

If instead you have a source distribution tarball that you downloaded then do the following:

% untar <python_package>.tar.gz
% cd <python_package>
% python setup.py install --user

Install simple module

For simple python modules that are just a single file you only need to copy it to the right location:

% cp simple_module.py ~/.local/lib/python2.6/site-packages/

Remember

Don't forget that whenever you install a new package this way you need to be in the CIAO environment so that you are using the CIAO python to do the installation.



    7           9