Python Admin

Installation Procedure


% umask 022
% cd /src/util
util% cp /tmp/Python-3.4.3.tar.xz .
util% unxz Python-3.4.3.tar.xz
util% tar -xvf Python-3.4.3.tar
util% cd Python-3.4.3
Python-3.4.3% ./configure --prefix=/util/python-3.4.3 --with-tcltk-includes='-I/util/ActiveTcl/include' --with-tcltk-libs='/util/ActiveTcl/lib/libtcl8.6.so /util/ActiveTcl/lib/libtk8.6.so' --enable-shared

Python-3.4.3% make
Python-3.4.3% sudo make install clean

[install modules]

% sudo env LD_LIBRARY_PATH=/util/python-3.4.3/lib:${LD_LIBRARY_PATH} /util/python-3.4.3/bin/pip3 --trusted-host pypi.python.org install $MODULENAME

where $MODULENAME is:

docutils
sympy
pycrypto
paramiko
pexpect
unidecode
nltk
mpi4py
numpy
cython [takes a long time]
scipy [takes a long time]
pyparsing
pylab

[failures that didn't install with pip]

bzr
matplotlib
pycuda

[reset default links]

Python-3.4.3% cd /util
/util% sudo rm python python3
/util% sudo ln -s python-3.4.3 python
/util% sudo ln -s python-3.4.3 python3

[reset the /util/bin symbolic links]

% cd /util/bin
bin% sudo ln -s ../python-3.4.3/bin/python3.4 python3.4

[reset the /util/lib symbolic links]

% cd /util/lib
lib% sudo ln -s ../python-3.4.3/lib/libpython3.4m.so.1.0 libpython3.4m.so.1.0
lib% sudo ln -s ../python-3.4.3/lib/libpython3.4m.so libpython3.4m.so
lib% sudo ln -s ../python-3.4.3/lib/libpython3.so libpython3.so
lib% ln -s ../python-3.4.3/lib/python3.4/ python3.4

Install Optional Libraries

Install optional libraries, as specified by the CSE user community.

Manual Install Modules

We have to build some modules by hand.

mpi4py

% tar -xvf mpi4py-1.2.1.tar
% cd mpi4py-1.2.1
% vi mpi.cfg

Scroll down to the [openmpi] section, set:
mpi_dir              = /util/openmpi

% sudo /util/bin/python setup.py build --mpi=openmpi
% sudo /util/bin/python setup.py install

matplotlib


Upgrade numpy and scipy, above.

% gunzip matplotlib-1.4.3.tar.gz
% tar -xvf matplotlib-1.4.3.tar
% cd matplotlib-1.4.3
% sudo env LD_LIBRARY_PATH=/util/python-3.4.3/lib:${LD_LIBRARY_PATH} /util/bin/python setup.py build
% sudo env LD_LIBRARY_PATH=/util/python-3.4.3/lib:${LD_LIBRARY_PATH} /util/bin/python setup.py install

Also needed to:

% cd /util/lib
% sudo ln -s ../ActiveTcl/lib/libtcl8.6.so libtcl8.6.so
% sudo ln -s ../ActiveTcl/lib/libtk8.6.so libtk8.6.so

pycuda

Verify that /usr/lib64/libpython2.6.so.1.0 exists, or the compiler will not be able to find it.  Create a symlink if necessary:

[lethe] lib64% sudo ln -s /util/python/lib/libpython2.6.so.1.0 libpython2.6.so.1.0

% tar -xvf pycuda-0.94rc.tar
% cd pycuda-0.94rc
% ./configure.py --cuda-root=/util/cuda --boost-python-libname=libboost_python --boost-thread-libname=libboost_thread --boost-lib-dir=/util/boost/lib --boost-inc-dir=/util/boost/include

% sudo /util/bin/python setup.py install

[FAIL]

/util/boost/include/boost/type_traits/detail/cv_traits_impl.hpp:38: internal compiler error: in make_rtl_for_nonlocal_decl, at cp/decl.c:5067

Notes

  1. pip is the preferred installer program. Starting with Python 3.4, it is included by default with the Python binary installers.
  2. easy_install is now included by default.
  3. We need to configure Python with the ActiveTcl dependency because matplotlib depends on it.

References

  1. http://www.python.org/downloads/
  2. https://docs.python.org/3/installing/
  3. http://pypi.python.org/pypi/setuptools
  4. http://www.tkdocs.com/tutorial/install.html
  5. http://matplotlib.org/