Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install netcdf4-python to ubuntu14.04?

I would like to install netcdf4-python to my Ubuntu14.04. The libhdf5-dev_1.8.11_5ubuntu7_amd64.deb and libnetcdf-4.1.3-7ubuntu2_amd64.deb are installed. I downloaded netcdf4-1.1.8.tar.gz from https://pypi.python.org/pypi/netCDF4#downloads I tried configure it by

./configure --enable-netcdf-4 –with-hdf5=/usr/include/ --enable-share –prefix=/usr

but I got the following message:

bash: ./configure: No such file or directory

I do not know how I can install netcdf4-python. I would appreciated if someone helped me.

like image 763
Beata Avatar asked Jul 17 '15 08:07

Beata


3 Answers

I would strongly recommend using the Anaconda Python distribution. The full Anaconda distribution includes netcdf4 and the required libraries.

like image 133
jhamman Avatar answered Nov 11 '22 11:11

jhamman


The instructions for Ubuntu are here which are basically:

HDF5

Download the current HDF5 source release. Unpack, go into the directory and execute:

./configure --prefix=/usr/local --enable-shared --enable-hl
make 
sudo make install

To speed things up, compile on more than one processor using

make -j n 

where n is the number of processes to be launched.

netCDF4 e Download the current netCDF4 source release. Unpack, go into the directory and execute:

LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include ./configure --enable-netcdf-4 --enable-dap --enable-shared --prefix=/usr/local
make 
make install

Installing netcdf4-python When both HDF5 and netCDF4 are in /usr/local, make sure the linker will be able to find those libraries by executing

sudo ldconfig

then installing netcdf4-python is just a matter of doing

python setup.py install

Make sure you actually untar the files and cd to the correct directories.

like image 2
Padraic Cunningham Avatar answered Nov 11 '22 13:11

Padraic Cunningham


You can also use an alternative wrapper for the netCDF4, like the netcdf library (it compile the hdf5 and netCDF4 libraries from sourcecode, automatically), using:

pip install netcdf
like image 2
ecolell Avatar answered Nov 11 '22 13:11

ecolell