Sunday, April 15, 2012

Running PyBrain in a virtual environment

I recently worked on a class project using Neural Networks and PyBrain. Because my university gives High Performance Computing cluster accounts to students that request them, I decided it would be a good idea to put them to use.

To install PyBrain on a machine with no python installation or administrator access:

  1. Download and compile python 2.6.x
  2. Download virtualenv
  3. Create a virtualenv using the aforementioned python binary.
    python virtualenv -p /path/to/python2.6 ENV
  4. Source the virtual environment's environment
    source ENV/bin/activate
  5. Download and compile BLAS. Ensure to use -fPIC if your system requires it. Make sure NOOPTS and OPTS are correct.
  6. Download and compile LAPAC.
  7. Use pip to install numpy
    LAPACK=~/lapack-3.4.0/liblapack.a BLAS=~/BLAS/libfblas.a ~/scratch/work/ENV/bin/pip install numpy
  8. Download and compile scipy. set the --fcompiler option to gnu95, to ensure numpy and scipy use the same compiler.
    LAPACK=~/lapack-3.4.0/liblapack.a BLAS=~/BLAS/libfblas.a ~/scratch/work/ENV/bin/python setup.py build --fcompiler=gnu95
  9. Use pip to install pybrain.
    ~/scratch/work/ENV/bin/pip install pybrain
  10. Test pybrain.
    python
    >>import pybrain