RGDAL won't install

2020-08-19 06:18发布

问题:

I can't get RGDAL to install in R. I'm using Ubuntu 12.04.

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

I found some solutions which said to do this:

sudo apt-get install aptitude
sudo aptitude install libgdal-dev 
sudo aptitude install libproj-dev

I follow these through, accepting 'yes' when prompted, but afterwards the same original error. It doesn't resolve it. I wonder whether I should be downgrading something perhaps?

Thanks, James.

回答1:

First check that everything is up to date with:

sudo apt-get update

On a slight tangent - i usually also install and a few others (needed for libraries like tidyverse):

sudo apt-get install -y libxml2-dev libcurl4-openssl-dev libssl-dev

Then install Rgdal and proj.4 (you may have to click yes a few times):

sudo apt-get install libgdal-dev 
sudo apt-get install libproj-dev