Version 3 (modified by astephen, 11 years ago) (diff)


Installing the COWS stack in Python 2.6


These notes were initially developed as part of the process of porting the COWS stack (== cows + cowsserver + cowsclient) to Python 2.6 and Pylons 1.0 (see the migration to python 2.6 page. They also serve as a useful set of guidelines on how to build the COWS stack including a number of dependencies that require some manual intervention in the build process.

COWS server and COWS client

Since the COWS server dependencies are a superset of the COWS client dependencies you the installation procedure for the COWS server is presented in full and you can infer the subset of requirements for the COWS client.

Installing COWS server dependencies

The COWS Server compatible with Pylons 1.0 and Python 2.6 has the following dependencies:


COWS Server installation

These instructions suggest installing the COWS server into a virtualenv? self-contained python environment. They also suggest the use of pip? as the installation tool. Alternatively, buildout can be used.

Note that not everything builds automatically and there are various stages when environment variables need to be set to pick up appropriate versions of packages.

I have tried to order the dependency list correctly to avoid having to re-build any packages (hopefully!).

1. Non-python packages


# Manually install NetCDF $ cd $HOME $ mkdir -p external/netcdf/src $ cd external/netcdf/src $ wget $ tar xvzf netcdf-3.6.3.tar.gz $ cd netcdf-3.6.3/ $ ./configure --enable-shared --disable-f90 --disable-f77 --prefix=$HOME/external/netcdf $ make $ make install $ make check

numpy==1.3.0 numpy-1.3.0-py2.6-linux-x86_64.egg

easy_install gave errors but pip said fine, trust pip!

cdat_lite cdat_lite-5.2_1-py2.6-linux-x86_64.egg

should work as long as it can find NetCDF: export NETCDF_HOME=$HOME/external/netcdf



cairo==1.2.4 Probably exists on any server, but can be built by Yast

pycairo==1.2.2 $ Needed to build pycairo compatible with release on westerly of cairo (1.2.4) so used 1.2.2 of pycairo $ wget $ tar xvzf pycairo-1.2.2.tar.gz $ cd pycairo-1.2.2/ $ # Need to make this dir for it to install OK $ mkdir $HOME/python26/lib/pkgconfig $ python build $ python install THen tested with a line stolen from geoplot (see:

geos # needed for file for python $ cd $ cd external $ wget $ bunzip2 geos-3.2.2.tar.bz2 $ tar xvf geos-3.2.2.tar $ cd geos-3.2.2 $ mkdir $HOME/external/geos $ ./configure --prefix=$HOME/external/geos $ make $ make install

Environment needs some of these... $ export GEOS_DIR=$HOME/external/geos $ export LD_LIBRARY_PATH=$HOME/external/geos/lib:$HOME/external/geos/lib/

matplotlib matplotlib-1.0.0-py2.6-linux-x86_64.egg # Followed instructions on basemap and matplotlib at:

$ diff setup.cfg.template setup.cfg 5c5 < tag_svn_revision = 1 ---

#tag_svn_revision = 1

10c10 < #basedirlist = /usr ---

#basedirlist = /disks/westerly1/cow/svn/cowsserver/cowsserver/buildout/matplotlib

75c75 < #backend = Agg ---

backend = Cairo



export MATPLOTLIBDATA=$HOME/svn/cowsserver/buildout/matplotlib/mpl-data $ cd buildout $ cp -r matplotlib/lib/matplotlib/mpl-data matplotlib/

basemap basemap-1.0-py2.6-linux-x86_64.egg # NOW basemap $ export GEOS_DIR=$HOME/external/geos $ easy_install -eb . basemap # this creates a local download to build basemap in $ cd basemap/ $ python bdist_egg $ cp dist/*.egg ../eggs/ $ cd ../ $ cp -r basemap/build/lib.linux-x86_64-2.6/mpl_toolkits/basemap/data basemap-data $ export BASEMAPDATA=$HOME/svn/cowsserver/buildout/basemap-data Environment seemed to then need: $ export DBFLIBSO=$HOME/svn/cowsserver/buildout/basemap/build/lib.linux-x86_64-2.6 # SOME TESTS TO RUN - just want to see they don't raise Exceptions Test 1:

from matplotlib.backends.backend_cairo import RendererCairo, FigureCanvasCairo, cairo, Affine2D

Test 2:

import pylab
from mpl_toolkits.basemap import Basemap
b = Basemap()


from mpl_toolkits import basemap
x = basemap.Basemap(llcrnrlon=-10.5,llcrnrlat=49.5,urcrnrlon=3.5,urcrnrlat=59.5,
            rsphere=[6370997, 1])


geoplot (latest trunk - under qesdi) - investigate fix in rsphere usage!!!!

# From googling (see: it looks like you need to specify the ellipsoid. I tried this using the "rsphere" argument which can be:
 1. A float/int of the earth's radius (DEFAULT = 6370997m)
 2. A sequence of (major_axis, minor_axis) - I got segmentation faults when I tried making these similar, so I used option 3...
 3. The documentation says """Note: sometimes an ellipsoid is specified by the major axis and an inverse flattening parameter (if). The minor axis (b) can be computed from the major axis (a) and the inverse flattening parameter using the formula if = a/(a-b).""" - I set it to (6370997, 1) for now.

pil PIL-1.1.7-py2.6-linux-x86_64.egg image_utils image_utils-1.0-py2.6.egg

Pylons==1.0 installed: {{{ Beaker-1.5.4-py2.6.egg decorator-3.2.0-py2.6.egg FormEncode?-1.2.3dev-py2.6.egg Mako-0.3.4-py2.6.egg MarkupSafe?-0.11-py2.6-linux-x86_64.egg Paste-1.7.4-py2.6.egg PasteDeploy?-1.3.4-py2.6.egg PasteScript?-1.7.3-py2.6.egg Routes-1.12.3-py2.6.egg simplejson simplejson-2.1.1-py2.6-linux-x86_64.egg Tempita-0.5dev-py2.6.egg WebError?-0.10.2-py2.6.egg WebHelpers?-1.2-py2.6.egg WebOb?-1.0-py2.6.egg WebTest?-1.2.2-py2.6.egg }}}

mock mock-0.7.0b2-py2.6.egg nose nose-0.11.4-py2.6.egg

Shapely Shapely-1.2.5-py2.6.egg

Genshi Genshi-0.6-py2.6.egg owslib OWSLib-0.3.1-py2.6.egg

cows cowsserver

# used for testing ###### NOT NEEDED: lxml-2.3beta1-py2.6-linux-x86_64.egg

libxml2 libxml2-python-2.6.21 Web page says libxml2dom needs libxml2 so found build and installed: $ cd $ cd external $ wget $ tar xzvf libxml2-python-2.6.21.tar.gz $ cd libxml2-python-2.6.21/ $ python build $ python install

libxml2dom libxml2dom-0.4.7-py2.6.egg

# Test $ python -c 'import libxml2; import libxml2dom'