installing Iris on Scientific Linux 6

338 views
Skip to first unread message

karina

unread,
Feb 26, 2013, 5:27:36 AM2/26/13
to scitoo...@googlegroups.com
Having just installed Iris on my laptop (Scientific Linux release 6.3 (Carbon), based on GNOME 2.28.2, i686), I thought it might be useful to post the steps I went through. (for much better and general instructions, see the Iris and Cartopy sites (http://scitools.org.uk/) and the sites for the other packages mentioned here.)

I've split it into two sections:

(1) How I would install it, if I had to do it again
(2) How I actually went about installing it (including the wrong turns I made!)

If someone else is also trying to install Iris on Scientific Linux, then probably the first section is more useful but the second section has the links I went for advice when things went wrong.

A dollar sign $ shows commands entered to the unix prompt, three 'greater than' symbols >>> show commands entered at the python prompt.

disclaimer: this method worked for me, but I have no idea how well it would work for someone else. Also, I'm sure it could be improved/made easier... please let me know how in the comments section.



(1) How I would install it, if I had to do it again


Install these packages by ticking boxes in 'add/remove software':
git*, gcc-4.4.6-4.el6,gcc-c++-4.4.6-4.el6,gcc-fortran-4.4.6-4.el6,libgcc-4.4.6-4.el6, gnome-python2-devel-2.28.0-3.el6, blas-3.2.1-4.el6,blas-devel-3.2.1-4.el6, lapack-3.2.1-4.el6, libpng-2:1.2.49-1.el6_2, libpng-devel-2:1.2.49-1.el6_2,libpng-devel-2:1.2.49-1.el6_2, readline-devel-6.0-4.el6, openssl*, m2crypto-0.20.2-9.el6, nss*, pyOpenSSL-0.10-2.el6, swig-1.3.40-6.el6, swig-doc-1.3.40-6.el6
hdf4-4.2.6-1.el6.rf,hdf4-devel-4.2.6-1.el6.rf,hdf5-1.8.7-1.el6.rf,hdf5-devel-1.8.7-1.el6.rf
(I may not have needed all of these, and I may have used some packages I already had installed)

The rest of the installations were done as superuser.

Download python2.7 from http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz and install with
$ ./configure ; make install

Download http://download.osgeo.org/geos/geos-3.3.7.tar.bz2 and install with
$ CFLAGS="-O1" CXXFLAGS="-O1" ./configure --enable-python
$ make install

Change the contents of the file /etc/ld.so.conf

from

include ld.so.conf.d/*.conf

to

/usr/local/lib
include ld.so.conf.d/*.conf

and then run

$ldconfig

Download http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.2.1.1.tar.gz and install with
$./configure --enable-netcdf-4 --enable-shared --enable-dap
$make
$make install
$make check

$wget http://peak.telecommunity.com/dist/ez_setup.py
$python2.7 ez_setup.py -U setuptools

$wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$python2.7 get-pip.py

Then install lots of packages with pip:

$pip-2.7 install cython
$pip-2.7 install shapely
$pip-2.7 install numpy
$pip-2.7 install scipy
$pip-2.7 install pyshp
$pip-2.7 install matplotlib

$git clone https://github.com/SciTools/cartopy.git
$cd cartopy ; python2.7 setup.py install

Download ftp://ftp.unidata.ucar.edu/pub/udunits/udunits-2.1.24.tar.gz and install with
$./configure ; make install ; make install-html install-pdf 

Download http://netcdf4-python.googlecode.com/files/netCDF4-1.0.2.tar.gz and install with
$python2.7 setup.py install

Download pyke from http://sourceforge.net/projects/pyke/files/latest/download?source=files and install with
$python2.7 setup.py install

Download http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.6/basemap-1.0.6.tar.gz/download and install with
$python2.7 setup.py install

$pip-2.7 install nose

$git clone https://github.com/SciTools/iris.git   
$cd iris ; python2.7 setup.py install
and if /usr/local/lib/python2.7/site-packages/iris doesn't then exist,
$cp -R /home/Me/Downloads/iris/build/lib/iris /usr/local/lib/python2.7/site-packages/iris

$git clone https://github.com/SciTools/iris-sample-data.git
$cp -R /home/Me/Downloads/iris-sample-data/sample_data /usr/local/lib/python2.7/site-packages/iris/


(2) How I actually went about installing it (including the wrong turns I made!)


Installed these things through 'add/remove software':
git*, geos-3.2.1-1.el6.rf, geos-devel-3.2.1-1.el6.rf, gcc-4.4.6-4.el6, gcc-c++-4.4.6-4.el6, gcc-fortran-4.4.6-4.el6, libgcc-4.4.6-4.el6, gnome-python2-devel-2.28.0-3.el6, blas-3.2.1-4.el6, blas-devel-3.2.1-4.el6, lapack-3.2.1-4.el6, libpng-2:1.2.49-1.el6_2, libpng-devel-2:1.2.49-1.el6_2

Cartopy needs python 2.7 but 'add/remove software' only has things to do with python 2.6, so had to install python 2.7 by hand:

Downloaded it from http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz and installed with
./configure ; make ; make install

Can't use left an right arrows on command line in python2.7 (can in python2.6) -> following http://stackoverflow.com/questions/893053/python-shell-arrow-keys-do-not-work-on-remote-machine, installed readline-devel-6.0-4.el6 from 'add/remove software', then reinstalled python2.7.

Following http://superuser.com/questions/527656/installing-setuptools-for-python-2-7-3-on-sl6-returns-an-error-that-i-dont-have, did

$wget http://peak.telecommunity.com/dist/ez_setup.py
$python2.7 ez_setup.py

$wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$python2.7 get-pip.py

Then could install lots of things with pip:

$pip-2.7 install cython
$pip-2.7 install shapely
$pip-2.7 install numpy
$pip-2.7 install scipy
$pip-2.7 install pyshp

Tried also to install matplotlib:

$pip-2.7 install matplotlib

but got the error message

<URLError: <urlopen error unknown url type: https>

Used 'add/remove software' to install openssl*, m2crypto-0.20.2-9.el6, nss*, pyOpenSSL-0.10-2.el6 (see advice on http://www.xinotes.org/notes/note/628/)

then reinstalled python2.7, reran ez_setup.py and get-pip.py:
$python2.7 ez_setup.py -U setuptools
$python2.7 get-pip.py

and then
$pip-2.7 install matplotlib
seemed to go ok.

Installed netcdf-4.1.2-1.el6 and netcdf-devel-4.1.2-1.el6 in 'add/remove software'.

Installed hdf4-4.2.6-1.el6.rf,hdf4-devel-4.2.6-1.el6.rf,hdf5-1.8.7-1.el6.rf,hdf5-devel-1.8.7-1.el6.rf in 'add/remove software'.

Tried to install cartopy with
git clone https://github.com/SciTools/cartopy.git
$cd cartopy
$python2.7 setup.py install

and tested it by trying to import cartopy into a python session

>>> import cartopy

but got the error message

ImportError: /usr/local/lib/python2.7/site-packages/cartopy/trace.so: undefined symbol: GEOSPreparedDisjoint_r

Uninstalled geos-3.2.1-1.el6.rf and geos-devel-3.2.1-1.el6.rf in 'add/remove software'.

and tried installing geos by hand by using the version at http://download.osgeo.org/geos/geos-3.3.7.tar.bz2 with
$./configure
$make
$make install

then recompiled cartopy. But

>>>import cartopy

still gave the error message

OSError: libgeos_c.so.1: cannot open shared object file: No such file or directory

Following advice at: http://stackoverflow.com/questions/1099981/why-cant-python-find-shared-objects-that-are-in-directories-in-sys-path
(also see http://ubuntuforums.org/showthread.php?t=1815240), changed contents of

/etc/ld.so.conf

from

include ld.so.conf.d/*.conf

to

/usr/local/lib
include ld.so.conf.d/*.conf

and then ran

$ldconfig

Now

>>import cartopy

gives no error message.

Downloaded ftp://ftp.unidata.ucar.edu/pub/udunits/udunits-2.1.24.tar.gz and installed with
$./configure
$make
$make install                  
$make install-html install-pdf  
$make clean

Downloaded http://netcdf4-python.googlecode.com/files/netCDF4-1.0.2.tar.gz and installed with
$python2.7 setup.py build

Downloaded pyke from http://sourceforge.net/projects/pyke/files/latest/download?source=files and installed with
$python2.7 setup.py install

Downloaded http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.6/basemap-1.0.6.tar.gz/download and installed with
$python2.7 setup.py install

$pip-2.7 install nose

Then tried to install Iris

$git clone https://github.com/SciTools/iris.git   
$cd iris
$python2.7 setup.py install

This gave no errors, but didn't actually seem to have installed it - had just built it. So tried doing the installation bit by hand, by simply copying it over:

$cp -R /home/Me/Downloads/iris/build/lib/iris /usr/local/lib/python2.7/site-packages/iris

The Iris sample data wasn't included with Iris, so added this:

$git clone https://github.com/SciTools/iris-sample-data.git
$cp -R /home/Me/Downloads/iris-sample-data/sample_data /usr/local/lib/python2.7/site-packages/iris/

Then I attempted to run this Iris example script (included in the Iris package)

$ python2.7 COP_maps.py

but it gave the error

python2.7: GeometryComponentFilter.cpp:35: virtual void geos::geom::GeometryComponentFilter::filter_ro(const geos::geom::Geometry*): Assertion `0' failed.

Something similar is described at http://proj.badc.rl.ac.uk/cedaservices/ticket/26. Their example reproduces this error message on my computer.

I went back to geos and ran
$make check

and saw that 'testrunner' failed. Then I reinstalled geos with

$CFLAGS="-O1" CXXFLAGS="-O1" ./configure
$make
$make check

but 'testrunner' still failed.

Looking at http://trac.osgeo.org/geos/ticket/469, they used an --enable-python option, so tried

$make distclean
$CFLAGS="-O1" CXXFLAGS="-O1" ./configure --enable-python
$make

This gives the error:
make[2]: Entering directory `/home/Me/Downloads/geos/geos-3.3.7/swig/python'
SWIG is disabled, can't build geos_wrap.cxx

So installed swig-1.3.40-6.el6, swig-doc-1.3.40-6.el6 from 'add/remove software'

Tried the geos configure script again, this time got swig:true. Ran

$make check

again, and this time it passed all tests including 'testrunner' successfully, so re-installed geos. Then I tried the geos example at http://proj.badc.rl.ac.uk/cedaservices/ticket/26 and the Iris example script COP_maps.py again

$python2.7 geos_test.py
$python2.7 COP_maps.py

and they both run without errors.

Tried another example Iris script:

$python2.7 COP_1d_plot.py

which gave the error message

OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/iris/fileformats/_pyke_rules/compiled_krb'

Tried running

$python2.7 COP_1d_plot.py

as root instead and this gave the error message

RuntimeError: Module 'netCDF4' not available or not installed
Exception AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('/usr/local/lib/python2.7/site-packages/iris/sample_data/E1_north_america.nc')> ignored

Tried
>>>import netCDF4

but got the error

ImportError: /usr/local/lib/python2.7/site-packages/netCDF4.so: undefined symbol: nc_inq_var_fletcher32

This post describes the same problem: http://code.google.com/p/netcdf4-python/issues/detail?id=60

When installing netcdf4-python, the screen output said

HDF5 found in /usr
netCDF4 found in /usr

so it was finding both libraries. I'm guessing the version of the netcdf library available through 'add/remove software' has not been compiled with the option --enable-netcdf-4 as
nm -p /usr/lib/libnetcdf.so.7 | grep nc_inq_var_fletcher32
doesn't return anything. So uninstalled netcdf-4.1.2-1.el6 and netcdf-devel-4.1.2-1.el6 from 'add/remove software' and downloaded http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.2.1.1.tar.gz. Installed this with

$./configure --enable-netcdf-4 --enable-shared --enable-dap
$make
$make install
$make check

Reinstalled the netCDF4-1.0.2 python library and now

$python2.7 COP_1d_plot.py

runs successfully.

Alistair Sellar

unread,
Feb 26, 2013, 9:02:42 AM2/26/13
to scitoo...@googlegroups.com
Hi,

I've just installed on ubuntu 12.10, and now very happy to be able to use Iris while homeworking, without being at the mercy of remote windows login + citrix + exceed.

But the first time I tried to iris.load() a file, I got the same error as Karina:

OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/Iris-1.3.0_dev-py2.7.egg/iris/fileformats/_pyke_rules/compiled_krb/fc_rules_cf_fc.py

I tried the same load command as root, and got:
>>> import iris
>>> iris.load('/home/ali/mme/FOAM/u_FOAM_12n23w_-36.nc')
writing [iris.fileformats._pyke_rules.compiled_krb]/fc_rules_cf_fc.py
writing [iris.fileformats._pyke_rules.compiled_krb]/compiled_pyke_files.py
[<iris 'Cube' of Zonal wind stress...etc

This was only required once, and then I could run the same commands as a normal user.  I installed everything as root, so the user did not have permissions.  Presumably it just needed to write to these files once, the first time load() was invoked.  If it happens for a future command, I'll probably just chmod the relevant directory so that the user has write permissions.

I wonder what I should have done to avoid this though?

Alistair

esc24

unread,
Feb 28, 2013, 9:12:23 AM2/28/13
to scitoo...@googlegroups.com
Just a quick pointer to https://github.com/SciTools/installation-recipes

As the readme states:

"This repository contains step-by-step instructions for installing Iris and/or Cartopy on different operating systems. Each system has its own perculiarities so the steps may need adapting for you own needs. Please consult the README and INSTALL files for Cartopy and Iris prior to looking at these recipes."

We'd welcome any additional recipes or comments.

bblay

unread,
Mar 8, 2013, 6:56:22 AM3/8/13
to scitoo...@googlegroups.com
Thanks for this info, Karina and Alistair.
I've logged the pyke rules file problem in ticket 386.
Reply all
Reply to author
Forward
0 new messages