On
Cray XC30, the default Python is at version 2.6. The recent version in 2.x series is 2.7 with many
improvements and it includes many features to reach 3.x series. I will show you how to setup your own Python 2.7 in your
$WORK directory.
Required Packages
Compilation and Installation
Firstly, load the GNU environment.
% module unload PrgEnv-cray
% module load PrgEnv-gnu
Next, download and extract the latest version of Python 2.7.x.
% cd $WORK/setup
% wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
% tar zxf Python-2.7.6.tgz
% cd Python-2.7.6
It is time for compilation and installation.
% ./configure --prefix=$WORK \
--enable-ipv6 --enable-unicode=ucs4 \
--enable-shared --enable-profiling \
CC=gcc CPP=cpp CFLAGS=-I/usr/include/ncurses LDFLAGS=-L.
% make |& tee make.log
You may see something like,
Python build finished, but the necessary bits to build these modules were not found:
bsddb185 dl imageop
sunaudiodev
... but do not worry. It is expected and those modules are deprecated.
It is time to do some tests.
% make test
If there is no special fails, just do the installation.
% make install
Now, you can use your built version of Python, which is located at
$WORK/bin/python, by default because
$WORK/bin is already in your system's path. If it is not available, please log out and log in again.
For some personal reasons, I need a Python version which is not depended on
libpython.so. I have to build once again without
--enable-shared option.
% ./configure --prefix=$WORK \
--enable-ipv6 --enable-unicode=ucs4 \
--enable-profiling \
CC=gcc CPP=cpp CFLAGS=-I/usr/include/ncurses
% make |& tee make.log
% make install
Tools for Making Package Installation Easier
For install and upgrade packages easier, we will use setuptools (easy_install) and pip.
% cd $WORK/setup
% wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-2.2.tar.gz
% tar zxf setuptools-2.2.tar.gz
% cd setuptools-2.2/
% $WORK/bin/python setup.py install
% $WORK/bin/easy_install pip
If you use
tcsh
as the default shell interpreter, please logout and login again for activate the new installed tools.
Testing Tools
We will install Nose for testing some packages such as NumPy and SciPy.
% easy_install nose
Interactive Shell
% $WORK/bin/easy_install ipython