Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

netcdf

I have tried to install ncdf4 package. I have R version 3.1.1.

The problem seems to be finding the nc-config. If I Google for this specific problem, then I find people with the same problem, who solved it by installing the Debian package libnetcdf-dev before installing ncdf4.

I already installed that package but I keep having the same problem,

The error is as follows:

checking for nc-config... no
-----------------------------------------------------------------------------------
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.
like image 280
Santiago I. Hurtado Avatar asked Mar 19 '17 19:03

Santiago I. Hurtado


3 Answers

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
like image 124
Oatman Avatar answered Oct 16 '22 13:10

Oatman


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

like image 28
F. Privé Avatar answered Oct 16 '22 13:10

F. Privé


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"
like image 8
Aji Avatar answered Oct 16 '22 13:10

Aji