Search code examples
rcentosgdalrgdalcentos8

error in install.packages 'rgdal': gdal-config not found - configure argument error


I am trying to install rgdal package in rstudio. I am using centos8. I have already installed:

sudo yum install gdal gdal-devel
sudo yum install geos geos-devel 

I have also tried to install using:

install.packages('rgdal', type = "source", configure.args=c(
    '--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config',
    '--with-proj-include=/Library/Frameworks/PROJ.framework/Headers',
    '--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'))

My error message:

configure: error: gdal-config not found - configure argument error.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/motipai/R/x86_64-redhat-linux-gnu-library/4.0/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp5jeQl8/downloaded_packages’

Solution

  • installing first in terminal:

    sudo yum install gdal.x86_64 gdal-devel.x86_64 gdal-libs.x86_64
    sudo yum install proj.x86_64 proj-devel.x86_64
    

    and then in r console:

    install.packages("rgdal")
    

    Solves the probem.