wtorek, grudnia 23, 2008

Building Pymol SVN on Archlinux

Lately I've been neglecting my blog for the sake of my work as a Ph.D. student (programming in Fortran). I'm going to catch up on this. Writing some Fortran code isn't that hard even if you are starting to learn the language from scratch like I do, but definitely it isn't the type of "coding is fun" programming language like Python for example. Speaking of Python, since 3rd of December your python scripts are getting old, because Python 3.0 is out. The new version brings major changes in the language that make you previous HelloWorld.py program stop working (print is now a function and should be called out print("Hello World!") instead of print "Hello World!"). Many programs I use require Python 2.4 or 2.5, some like OpenOffice.org Python 2.6 and soon some will require Python 3.0. Keeping compatibility on a system is getting problematic. Luckily I've installed Archlinux on my desktop at work which makes life easier if you know how to use it. I wanted to install the latest Pymol version from svn, but I've found it's incompatible with Python 2.6 which was required as I mentioned above for OO.o. So here's what I've done.

First I've installed a separate python version from the repositories - Python 2.4 # pacman -Sy python24
After this I needed Pmw for the GUI. It can be done by building from source like this:
# wget http://downloads.sourceforge.net/pmw/Pmw.1.3.2.tar.gz
# tar -xvzf Pmw.1.3.2.tar.gz
# cd Pmw.1.3.2/src
# python2.4 setup.py build
# python2.4 setup.py install
of by using a modified python-pmw PKGBUILD from the AUR. Just make sure it uses python 2.4 by changing in the build function the default python:
build() {
cd $startdir/src/Pmw.$pkgver/src
python setup.py build
python setup.py install --prefix=/usr --root=${startdir}/pkg
}
to python2.4:

build() {
cd $startdir/src/Pmw.$pkgver/src
python2.4 setup.py build
python2.4 setup.py install --prefix=/usr --root=${startdir}/pkg
}

After this you are ready to build pymol from the SVN:
# svn co https://pymol.svn.sourceforge.net/svnroot/pymol/trunk/pymol pymol
# cd pymol
# python2.4 setup.py install
# python2.4 setup2.py install
# cp ./pymol /usr/local/bin/pymol

Thats It!
Now an upgrade of Python to 3.0 will not mess up with your Pymol installation.

Brak komentarzy: