11

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.

TheRealJimShady
  • 777
  • 3
  • 9
  • 24
  • 5
    Installing `libgdal-dev` should have fixed it. Are you sure you installed `libgdal-dev` and the error is the same? – Mike T Jul 14 '15 at 00:23
  • Hi Mike. Thanks for the response. I have fixed this but I'm not quite sure how to be honest. Basically when I did 'sudo aptitude install libgdal-dev' instead of saying 'yes' to the solution proposed, I said 'no' and it gave me another option, and I said 'yes' to that instead. I think maybe it rolled some of my libraries back to earlier versions perhaps. Anyway, it's working. :-) – TheRealJimShady Jul 14 '15 at 10:47
  • Installing libgdal-dev worked for me too. Thanks! – Rodrigo Aug 28 '15 at 01:09
  • 3
    See also [this answer](http://stackoverflow.com/a/15248953/2641825) `sudo apt-get install libgdal1-dev libproj-dev` – Paul Rougieux Feb 22 '16 at 09:19
  • 1
    How to install `libgdal-dev` on mac? I saw Ubuntu or Linux every where, but it seems doesn't work for mac OSX. – JW.ZG Feb 24 '16 at 03:10
  • In fact, I have the same problem. In your description, I run sudo apt-get install aptitude sudo aptitude install libgdal-dev as you suggeested. When it runs sudo aptitude install libgdal-dev, it asked me y/n/q, i tried y at first, but did not work. Then I tried n, it worked! Now I have installed rgdal in my R. Thank you very much. – Max Jul 04 '16 at 02:54
  • Possible duplicate of [rgdal package installation](http://stackoverflow.com/questions/15248815/rgdal-package-installation) – sebastian-c Mar 16 '17 at 13:51

1 Answers1

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
Andy Barker
  • 77
  • 1
  • 7