[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #PYH-377335]: Installing netCDF4 for python on Ubuntu 10.04



Hi Frank,

> I have lost 3 days now trying to install netcdf-python on my ubuntu
> 10.04 Server.

Sorry to hear that, but I've heard python packages that have lots of 
dependencies
can be difficult to get installed.  I use the Enthought Python Distribution
(EPD) which includes netCDF4-python, and it seems to work well, but I don't know
if that's an option for you, as there is a yearly subscription for non-academic
users:

  http://www.enthought.com/products/epd.php

> Below is what I did. I would be relieved if you had an idea what I do wrong.

I don't have access to an Ubuntu system for testing, but I'll make a few 
comments
on what I think is the problem.

> This: http://code.google.com/p/netcdf4-python/wiki/UbuntuInstall
> did not work in the first place, even so I really typed each letter as
> it is said!
> 
> My so far proceeding:
> 
> ubuntu 10.04 LTS auf Server
> python 2.6

I'm using python 2.7.3 from EPD, in case that makes any difference.  At least 
it 
shows there are no incompatibilities between the latest python and 
netCDF4-python.

> numpy installed
> zlib installed in /usr/local/zlib
> szip installed in usr/local/szip
> hdf5 1.8.9 (compiled so it works with fortran but disable-shared)

The netCDF-4.2 software doesn't require that hdf5 be installed with Fortran
support, although that shouldn't be a problem.  I'm just using the default
hdf5-1.8.9 build, without szlib or Fortran support, but with zlib.

> in /usr/local/hdf5-1.8.9
> 
> -->hdf5 works so far with fortran!
> 
> need python script wich can:
> > import netCDF4
> 
> figured out it needs hdf5, netcdf4 and python-netcdf4
> 
> tried to install netcdf 4.2 with:
> ./configure --enable-netcdf-4 --enable-shared --prefix=/usr/local/netcdf4
> -->configure fails with some hdf5 problems

We should be able to get that working, as there are other users who have
successfully installed netCDF-4.2 on Ubuntu.  I suspect it is as simple as
using CPPFLAGS and LDFLAGS instead of "--with-hdf5" on the configure
invocation, because netCDF-4.2 doesn't support use of "--with-hdf5" as a 
configure option.  Use something like this instead:

  CPPFLAGS=-I/usr/local/hdf5-1.8.9/include LDFLAGS=-L/usr/local/hdf5-1.8.9/lib 
./configure --prefix=/usr/local/netcdf4
  make check install

You don't actually need --enable-netcdf-4 --enable-shared, as those are the
default if configure is told where to find the HDF5 library with the CPPFLAGS
and LDFLAGS environment variables.

Getting netCDF4-python working with netCDF-4.2 (or the new release candidate
netcdf-4.2.1-rc1) is the best path forward, rather than trying an older
version of netCDF, in my opinion.

If the above doesn't work, send us the output from configure and make check.

If the above works (replacing "--with-hdf5" with CPPFLAGS and LDFLAGS settings
for the netCDF-4.2 configure), it would be good to point out that the current 
Ubuntu installation instructions  no longer work to Jeff Whitaker.

In fact, I'll Cc: Jeff on this support response (Hi Jeff!), because I know 
"--with-hdf5" doesn't work with netCDF-4.2, for reasons explained here:

  
http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2011/msg00345.html

--Russ

> tried:
> sudo ldconfig on all relevant
> -->diverse different errors, not much of a change
> 
> tried to get other hdf5 version from repositories:
> 
> sudo apt-get install libhdf5-serial-dev
> 
> then
> 
> sudo apt-get install libnetcdf-dev
> sudo apt-get install libnetcdf4
> sudo apt-get install python-netcdf
> 
> -->worked, but still the python script wont be able to find netcdf4
> 
> tried to install netcdf 4.1.1 with:
> ./configure --enable-netcdf-4 --enable-shared --prefix=/usr
> -->configure, make, make check...all work fine
> 
> then tried to install netCDF4-1.0 for python:
> python setup.py build
> sudo python setup.py install
> cd test;python run_all.py
> --> ImportError: netCDF4 module must be linked against HDF5 version
> 1.8.4-patch1 or higher, got 1.8.4
> 
> But I cannot find any repository with a newer version nor does
> compiling hdf5 work out...
> 
> --
> Frank Rüthrich
> Laboratory for Climatology and Remote Sensing
> Philipps University of Marburg
> Deutschhausstraße 12
> 35032 Marburg
> www.lcrs.de

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: PYH-377335
Department: Support netCDF
Priority: Normal
Status: Closed