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


Tuesday, March 13, 2012

Automount NTFS partition using Ubuntu 11.10

To automount an NTFS partiton, add the following to /etc/fstab:
15 UUID=58C7049A417B945D /media/media ntfs rw,auto,users,exec,nl=utf8,umask=003,gd=46,uid=1000 0 2

Substituting your partition's UUID and mount point (I chose /media/media). To find your partiton's UUID, run sudo blkid


Then, test with:
mount /media/media
This yields an error:
mozach@dm4:~$ mount /media/media
Mount is denied because setuid and setgid root ntfs-3g is insecure with the
external FUSE library. Either remove the setuid/setgid bit from the binary
or rebuild NTFS-3G with integrated FUSE support and make it setuid root.
Please see more information at
http://tuxera.com/community/ntfs-3g-faq/#unprivileged


To fix this we must recompile ntfs-3g to include FUSE support.
Download ntfs-3g source:
zach@dm4:~/ntfs$ wget http://tuxera.com/opensource/ntfs-3g_ntfsprogs-2012.1.15.tgz
Decompress:
zach@dm4:~/ntfs$ tar -xvzf ntfs-3g_ntfsprogs-2012.1.15.tgz
Configure (including internal FUSE support):
zach@dm4:~/ntfs/ntfs-3g_ntfsprogs-2012.1.15$ ./configure --with-fuse=internal
Compile:
zach@dm4:~/ntfs/ntfs-3g_ntfsprogs-2012.1.15$ make
Install:
zach@dm4:~/ntfs/ntfs-3g_ntfsprogs-2012.1.15$ sudo make install

Reboot and /media/media should be mounted automatically.

Friday, February 10, 2012

Fedora Core 16 bash hanging on 'command not found'

$ sasdasd
bash: sasdasd: command not found...
*wait for a few seconds*

Fedora thought the feature of attempting to look up an invalid command in the yum database was good to enable by default. I see how this is useful, but I find it really annoying (simply because it's slow).

To remove (as root):
sed -i 's/SoftwareSourceSearch=true/SoftwareSourceSearch=false/' /etc/PackageKit/CommandNotFound.conf