Install ncdf4 package: Error, nc-config not found or not executable

As @PaulHiemstra mentioned in the comments, find out where your nc-config is:

What you can do is open a fresh terminal and do which nc-config. This will show you where the file is actually located in your system. If this file is indeed installed, the problem is probably that Linux installs it in a given location, and R expects it somewhere else (/usr/local/bin vs /usr/bin for example). You can try to fix the issue by adding the library containing nc-config to your PATH environment variable. Or the problem could be unrelated, e.g. 32 bit vs 64 bit.\

For me, it is:

ubuntu@dark-horse:~$ which nc-config 
/home/ubuntu/miniconda3/bin/nc-config

I start with installing netcdf essentials using the below command

sudo apt-get install r-cran-ncdf4

The above command should have gotten nc-config installed, if not try:

sudo apt-get install netcdf-bin

Now, download the netcdf4 source

wget http://cirrus.ucsd.edu/~pierce/ncdf/ncdf4_1.13.tar.gz

Now, try to do the install

sudo R CMD INSTALL ncdf4_1.13.tar.gz --configure-args="--with-nc-config=/home/ubuntu/miniconda3/bin/nc-config"

On CentOS 7, using sudo yum install netcdf-devel.x86_64 in a terminal did the trick.


I was having a similar problem and these answers didn't quite work for me (Ubuntu 16.04.4 LTS).

I had to install the developer version using:

sudo apt-get install libnetcdf-dev

Tags:

R

Netcdf