Installing PyTables when you're not root

by Koen van de Sande

This guide describes how to install PyTables and its dependencies on Linux or other *nix systems when your user account is not root. Installing the HDF5 shared libraries and Python extensions NumArray and NumPy requires some non-trivial steps to work. We describe all steps needed. They only assumption is that you have Python 2.3 or higher and a C/C++ compiler (gcc) installed.

Installing HDF5

wget ftp://ftp.hdfgroup.org/HDF5/current16/src/hdf5-1.6.5.tar.gz

tar xzvf hdf5-1.6.5.tar.gz .

cd hdf5-1.6.5

./configure

make install

mkdir ~/software

mv hdf5 ~/software/

Installing NumArray

tar xzvf numarray-1.5.2.tar.gz

cd numarray-1.5.2

python setup.py install --home=~/software

We will also need to copy the header files of NumArray so PyTables can use them later on for compilation. Skipping this step will lead to compilation errors for PyTables.

cd include

cp -r numarray ~/software/hdf5/include/

Installing NumPy (optional)

It is not required to install NumPy; PyTables will work with just NumArray installed. However, I do recommend that you install NumPy as well, because PyTables can optionally use it.

tar xzvf numpy-1.0.tar.gz

cd numpy-1.0

python setup.py install --home=~/software

Python wrapper script

We've installed all dependencies of PyTables. We need to create a wrapper script for Python to let PyTables actually find all these dependencies. Had we installed them as root, they'd be trivial to find, but now we need to help a bit.

export PYTHONPATH=~/software/lib/python
export HDF5_DIR=~/software/hdf5
export LD_LIBRARY_PATH=~/software/lib/python/tables:~/software/hdf5/lib
python $*

chmod 755 p

p

Python 2.3.4 (#1, Feb  2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numarray
>>> import numpy
>>>

Note: you could do this differently by defining these environment settings somewhere in your startup scripts, but this wrapper script approach is cleaner.

Installing PyTables

tar xzvf pytables-1.3.3.tar.gz

cd pytables-1.3.3

p setup.py install --home=~/software

.. ERROR:: Can't find a local numarray Python installation.
   Please, read carefully the ``README`` file and remember that
   PyTables needs the numarray package to compile and run.

Running Python with PyTables support

p

Python 2.3.4 (#1, Feb  2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tables
>>> tables.__version__
'1.3.3'
>>>

Concluding remarks

Enjoy working with PyTables!

Koen


CategoryUserDocuments

UserDocuments/InstallingPyTablesWhenNotRoot (last edited 2008-04-21 11:12:44 by localhost)