Nikhail Arumoogum
Nikhail Arumoogum

Reputation: 173

Configure error in rgdal "gdal-config"

I am currently running some species distribution modelling and richness mapping in R on a linux cluster. In order to run my analyses I need to install rgdal so that the raster function in my modelling package works correctly. I have installed proj4 and gdal already. However when I attempt to install rgdal I get an error message:

checking for gdal-config... no
no

configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package 'rgdal'

This is the command I used to install rgdal package:

install.packages("rgdal", configure.args=c("--with-proj-include=/home/nikhail1/bin/proj-4.9.2/bin", "--with-proj-lib=/home/nikhail1/bin/proj-4.9,2/lib"))

However despite the gdal-config error, gdal seems to be installed onto my local system (the binary and library folders are present in the address to which I installed them). I also did not see any error messages during the gdal installation process. Why is this error occurring? How do I get R to recognize that this dependency is installed, or indeed if there is a problem how do I identify it? Most of the solutions I have found online are specific to Debian and Ubuntu systems which I am not using. I do not have authority to use sudo apt-get or yum commands. Are there any dependencies of gdal I am missing, as I have only installed proj 4.9.2?

I am new to the linux system, and the rgdal and gdal packages.

Thank you very much for you assistance

Kind Regards,

Nikhail

Upvotes: 10

Views: 11518

Answers (5)

NunonuN
NunonuN

Reputation: 1

For Arch based distros, just install gdal using pamac or Add/Remove Software before attempting any installation depending on rgdal in R.

Upvotes: 0

Abdinardo Oliveira
Abdinardo Oliveira

Reputation: 2765

I followed these steps:

  1. I installed python via Anaconda;
  2. After I opened a Linux terminal and ran sudo apt install libmysqlclient-dev;
  3. Then I ran sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev;
  4. Finally, I ran on R install.packages("rgdal");

Upvotes: 2

Shivam Shrotriya
Shivam Shrotriya

Reputation: 51

I could fix a similar issue on a CentOS 7 system by first installing 'gdal' and 'proj' libraries via terminal-

sudo yum install gdal*
sudo yum install proj*

And then set configure arguments in install.packages command as follow-

install.packages( pkgs = "rgdal", 
                         configure.args = c("--with-proj=/bin", "--with-gdal=/bin"),
                         dependencies=TRUE)

Both the 'gdal' and 'proj' libraries were installed in root/bin folder in this situation. Although the error output printed that 'gdal-config not found', the config file wasn't required at the end.

Upvotes: 4

Cristian E. Nuno
Cristian E. Nuno

Reputation: 2920

Installing RGDAL in R on Linux

Run this command in R:

# install package from CRAN
# but specify the library director
# the download method
# and the configuration arguments
# to allow for source installs
install.packages( pkgs = "rgdal"
                    , lib = "./R_Packages"
                    , method = "curl"
                    , configure.args = c(
                                   "--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config"
                                   , "--with-proj-include=/p/home/bin/proj4/include"
                                   , "--with-proj-lib=/p/home/bin/proj4/lib"
                                     ) 
      )

Answer comes from cross-referencing Errors installing rgdal on LINUX system? and Trouble installing rgdal.

Upvotes: 8

Nikhail Arumoogum
Nikhail Arumoogum

Reputation: 173

So i have finally solved the issue by adding the directory of the gdal-config file in the install.packages command.

Thank you very much for your assistance, Nikhail

Upvotes: 2

Related Questions