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

[netCDF #TBJ-718809]: problems to install netCDF 4.2 in Ubuntu 10.04



Elena,

> thanks for your answer. One of the issues I have with Ubuntu is that I
> cannot find anything except for my own files. If I make a search for netCDF
> eventually I get >20 folders distributed within many other folders.
> Searches take forever when I look for programs, and I cannot imagine a way
> to look for nf-config, that if I understood right is part of a program???

When you install netCDF from source, specifying --prefix=/some/place (the 
default for which is /usr/local), it installs everything in the bin/, lib/, 
include/, and share/ subdirectories of /some/place.  All the programs, such
as ncdump, ncgen, nc-config, and nf-config are thus in /some/place/bin/.

If you also installed netCDF from some binary packaging system, such as dpkg,
then the libraries, include files, binary programs, and shared files were 
installed someplace else, wherever dpkg puts them.  Maybe R installed 'ncd4'
someplace else ...

It's generally not a good idea to have multiple versions of a software package 
installed in different places, especially if it uses shared libraries.  That's 
because it's hard to tell which shared libraries should be updated when a bug 
fix or new release is provided.

> Thus, your solution sounds straight forward, but I don't know how to find
> that path. And secondly, would I have to do this every time I open R?

No, generally you can specify once where a library is installed by using an
environment variable you set automatically every time you login, in your
.cshrc or .profile file for example.  Or you can install libraries in a
standard place where programs always look for them, such as /usr/lib.  Or you
can configure your system with another standard place to look for standard
libraries, such as /usr/local/lib, and install all your extra software there.
Or you can start R with a script that specifies, with environment variables,
where it should look for shared libraries.

> And then there is this:
> 
> http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2012/msg00250.html

Yes, netCDF-3 is still more popular and widely used than netCDF-4, because of
a chicken-and-egg problem with data and software.  If you only need to access
netCDF-3 software, you can still build from the latest source version, such as
netcdf-4.2.1.1 currently, and specify --disable-netcdf-4 as a configure option,
or just dodn't tell configure where to find the HDF5 library, and it won't
compile the extra netCDF-4 functions.  The result will be a library that will
read or write any netCDF-3 data and against which you can compile and link any
netCDF-3 client software.

> I know eventually I will have to grab a linux handbook and learn how this
> system works, but it will not be this year. Sadly.

No one ever learns all of linux, just the things they need as they need them.
But it's like an investment, in that taking the time to learn a little bit as
you need it can later pay back big dividends in time saved ...

--Russ

> address@hidden> wrote:
> 
> > Hi Elena,
> >
> > > I have now spent a good 16 working hours trying to install netCDF 4.2 in
> > > Ubuntu 10.04. I am a biologist, new to Ubuntu and my programming skills
> > are
> > > nil. I have browsed what it feels like thousands of websites and most of
> > > the time I have trouble to follow the instructions.
> > >
> > > My problem started in R. I tried to install the package "ncdf4" and got
> > an
> > > error message saying
> > >
> > > Error, nc-config not found or not executable.  This is a script that
> > > comes with the
> > > netcdf library, version 4.1-beta2 or later, and must be present for
> > > configuration
> > > to succeed.
> > >
> > > Fair enough, but it happens that according to the Ubuntu Software
> > > Centre I already had lots of netcdf  and hdf5 files installed. If they
> > > are in the wrong place and thus R cannot read them, I don't know. I
> > > have no clue where the applications are kept. If I make a search for
> > > them I get folders with the same name in several places, so it seems
> > > impossible to me to track where R is looking for netcdf.
> >
> > Before starting R, you should set your PATH environment variable to include
> > a bin directory that includes the ncdump, ncgen, and nc-config commands.
> > And you should export that PATH so that R can use it.  For example, if you
> > are using a shell like bash or ksh and nc-config is in /usr/local/bin, then
> > you need to do something like this:
> >
> >   PATH=/usr/local/bin:$PATH
> >   export PATH
> >      ... start R ...
> >
> > If you're using a different shell, such as csh, the syntax for setting
> > PATH is
> > different (setenv PATH /usr/local/bin:$PATH ), but the result is the same .
> >
> > > Anyway, I tried to start from scratch and with the info gathered in a
> > > number of websites I think I managed to install HDF5, although I found
> > > rather confusing the command
> > >
> > >
> > > $ ./configure --prefix=/usr/local/hdf5 <more configure_flags>
> > > eventually I settled for
> > >
> > > ./configure --prefix=/usr/local/hdf5 --enable - shared --enable-hl
> >
> > Note that you needed to use "--enable-shared", not "--enable - shared".  I
> > asume
> > that was just a typo.
> >
> > > Not sure what it means but I finished the installation without errors,
> > > and I assume the package is somewhere and other packages will be able
> > > to find it.
> > >
> > > I repeated the process with netCDF:
> > >
> > > 1) download from your website
> > > 2) moved it to /home/elena/ (just because it felt wrong to leave it on
> > the desk)
> > > 3) went to the terminal and did:
> > >
> > > cd /home/elena/
> > > tar -xvzf netcdf-4.2.0.tar.gz
> > > cd netcdf-4.2
> > >
> > > Then problems started to arise. I tried several scripts for
> > > ./configure, neither of which gave error, but nevertheless when I run
> > > $. sudo make check install I did get errors. The options I tried were:
> > >
> > >
> > > ./configure --enable-netcdf-4 --enable-large-file-tests
> > > --enable-ncgen4 --with-hdf5=/usr/local --with-zlib=/usr/local
> > > --prefix=/usr/local/
> >
> > For versions 4.2 and later, the "--with-hdf5=..." configure option is no
> > longer
> > supported.  Instead, you have to set CPPFLAGS and LDFLAGS, as explained
> > here:
> >
> >   http://www.unidata.ucar.edu/software/netcdf/docs/build_default.html
> >
> > and then you don't need any of the "--enable" options above.  Also the
> > --prefix=/usr/local" is the default, so you can omit that also.  So you
> > could
> > just use:
> >
> >   CPPFLAGS=-I/usr/local/hdf5/include LDFLAGS=-L/usr/local/hdf5/lib
> > ./configure --with-zlib=/usr/local
> >
> > > When I run $. sudo make check install I got lots of gibberish ending with
> > >
> > > tst_h_dimscales4.c: In function ‘main’:
> > > tst_h_dimscales4.c:115: error: ‘H5F_LIBVER_18’ undeclared (first use
> > > in this function)
> > > tst_h_dimscales4.c:115: error: (Each undeclared identifier is reported
> > only once
> > > tst_h_dimscales4.c:115: error: for each function it appears in.)
> > > make[2]: *** [tst_h_dimscales4.o] Error 1
> > > make[2]: Leaving directory `/home/elena/netcdf-4.2/h5_test'
> > > make[1]: *** [check-am] Error 2
> > > make[1]: Leaving directory `/home/elena/netcdf-4.2/h5_test'
> > > make: *** [check-recursive] Error 1
> >
> > Yes, that's because the "--with-hdf5" configure option is no longer
> > supported, so
> > the HDF5 library you successfully installed couldn't be found.  Using the
> > CPPFLAGS
> > and LDFLAGS as in the above configure example will solve that problem.
> >
> > > Same thing happened with
> > >
> > > LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include ./configure
> > > --enable-netcdf-4 --enable-dap --enable-shared --prefix=/usr/local
> >
> > That's because the hdf5 include files and libraries are in
> > /usr/local/hdf5/include and
> > /usr/local/hdf5/lib, not /usr/local/include and /usr/local/lib.
> >
> > > And with
> > >
> > > CPPFLAGS=-I/home/elena/local/include LDFLAGS=-L/home/elena/local/lib
> > > ./configure --prefix=/home/elena/local
> > >
> > > I cannot stress enough how thankful I will be if you can provide a
> > > solution (ehem, asap), because I am really stuck and cannot go on with
> > > my work in R until I solve this... not to talk about the splitting
> > > headache and frustration accumulated over the past hours. By the way,
> > > I know that there is a new version of Ubuntu, but I prefer to wait for
> > > a few months to give smarter people the chance to fix all bugs before
> > > I update mine ;-)
> >
> > I hope the above makes this installation work for you!
> >
> > --Russ
> >
> > Russ Rew                                         UCAR Unidata Program
> > address@hidden                      http://www.unidata.ucar.edu
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: TBJ-718809
> > Department: Support netCDF
> > Priority: Normal
> > Status: Closed
> >
> >
> 
> 

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



Ticket Details
===================
Ticket ID: TBJ-718809
Department: Support netCDF
Priority: Normal
Status: Closed