Tuesday, December 2, 2008

Installing Python on Linux + Libraries- WITHOUT root access and in user defined dir

Isntructions to install python on linux without root access and in user defined dir.
Basically we confiugre and build python to a usr defined dir, make sure we install easy_isntall and use that to install rest of packages.

A. Install easy_install:
  1. * Create a new dir (i.e. ~/PYTHON)
  2. * Download zlib
  3. * Compile zlib in shared mode:
  4. ** > ./configure -s --prefix=~/PYTHON
  5. ** > make
  6. ** > make install
  7. * Download Python 2.5
  8. * Compile and install Python pointing to zlib and telling it where to install:
  9. ** > ./configure --with-zlib=~/PYTHON/include --prefix=~/PYTHON
  10. ** > make
  11. ** > make install
  12. * Edit your env var
  13. ** PATH=~/PYTHON/bin:$PATH
  14. ** export PYTHONHOME=~/PYTHON
  15. ** export PYTHONPATH=$PYTHONHOME:~/PYTHON/lib
  16. ** export LDFLAGS="-L/anfs/bigdisc/jkt27/PYTHON/lib -L/usr/lib" (so configure can find .so/.o files)
  17. ** export CPPFLAGS="-I/anfs/bigdisc/jkt27/PYTHON/include -I/usr/include" (so make/GCC can find header files)
  18. ** alias python='~/PYTHON/bin/python'
  19. * Download setuptools
  20. * Install:
  21. ** sh setuptools-0.6c9-py2.5.egg --prefix=~/PYTHON
B. Install packages
  1. > easy_install networkx
  2. Download numpy and install > python setup_all.py install
  3. etc.