vrijdag 14 augustus 2009

upgrade, reinstall scipy

So I jumped on the upgrade wagon again with ubuntu, but now I need to obtain last versions of scipy again. All is now python2.6, and only gfortran is supported anymore. Make sure g77 is completely removed, and gfortran latest distro package

The workflow:

NOTE: use the --prefix /usr flag if setup.py installs in the wrong directory.

1. make sure you do not have the repository stuff installed or old versions:
sudo apt-get remove python-scipy python-numpy python-matplotlib python-gnuplot
sudo rm -rf /usr/lib/python2.6/site-packages
sudo rm -rf /usr/lib/python2.6/dist-packages/numpy
sudo rm -rf /usr/lib/python2.6/dist-packages/scipy
sudo rm -rf /usr/lib/python2.6/dist-packages/matplotlib
sudo rm -rf /usr/lib/python2.6/dist-packages/scikits*
2. obtain source code if you do not have it yet:
svn co http://svn.scipy.org/svn/numpy/trunk numpy
svn co http://svn.scipy.org/svn/scipy/trunk scipy
svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib
svn co https://gnuplot-py.svn.sourceforge.net/svnroot/gnuplot-py/trunk gnuplot-py
svn co http://svn.scipy.org/svn/scikits/trunk/odes odes

3. Make sure you have the dependencies, eg
sudo apt-get install python-dev python-setuptools
For matplotlib, gtk backend, see build depend of the ubuntu package.
I used:

sudo apt-get install libpng-dev libgtk2.0-dev python-gtk2-dev python-imaging python-qt4 python-qt4-dev python-tz python-wxgtk2.8 zlib1g-dev libfreetype6-dev

4. go to numpy, update, compile, and install. Normally you need to remove /usr/lib/python2.6/site-packages/scipy or /usr/lib/python2.6/dist-packages/scipy and same for numpy first, but as python2.6 is new, those are not present.

cd numpy
sudo rm -rf build
svn up
sudo python setup.py install --install-layout=deb

cd scipy
sudo rm -rf build
svn up
sudo python setup.py install --install-layout=deb

cd matplotlib
sudo rm -rf build
svn up
sudo python setup.py install --install-layout=deb

3. Now I can reinstall my own module in scikits

cd programs/odes
sudo rm -rf build
svn up
sudo python setup.py install --install-layout=deb
Above works only on first install. Afterwards I obtain an error with zip files?? To resolve
rm -rf /usr/lib/python2.6/dist-packages/scikits/odes
sudo rm -rf build
sudo python setup.py install --single-version-externally-managed --root / --install-layout=deb
And then it is time to test if all is working again.
Interesting resource: python distutils