I'm strugling to install rgdal
library on Ubuntu 12.10.
Installation from within R results in error:
Error: gdal-config not found The gdal-config script distributed with GDAL could not be found. If you have not installed the GDAL libraries, you can download the source from http://www.gdal.org/ If you have installed the GDAL libraries, then make sure that gdal-config is in your path. Try typing gdal-config at a shell prompt and see if it runs. If not, use: --configure-args='--with-gdal-config=/usr/local/bin/gdal-config' with appropriate values for your installation.
ERROR: configuration failed for package ‘rgdal’ * removing ‘/home/rdk/R/x86_64-pc-linux-gnu-library/2.15/rgdal’ Warning in install.packages : installation of package ‘rgdal’ had non-zero exit status
R-sig-Geo, this two SE questions and other websites pointed me to the requirements of libgdal1-dev
.
But when I tried
sudo apt-get install libgdal1-dev
I end up with another error message
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:
The following packages have unmet dependencies: libgdal1-dev : Depends: libgdal-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages.
Again - when I try to install libgdal-dev
another dependencies error shows up
The following packages have unmet dependencies: libgdal-dev : Depends: libgeos-dev but it is not going to be installed Depends: libspatialite-dev but it is not going to be installed
Again trying libgeos-dev
gives message:
Depends: libgeos-c1 (= 3.3.3-1.1) but 3.3.3-2~precise2 is to be installed
E: Unable to correct problems, you have held broken packages.
and libspatialite-dev
:
Depends: libspatialite3 (= 3.1.0~rc2-1ubuntu1) but
3.1.0~rc2-2~precise1 is to be installed
Is there any way to tame those dependencies and have rgdal
running in Ubuntu?
My sessionInfo()
R version 2.15.1 (2012-06-22) Platform: x86_64-pc-linux-gnu (64-bit)
A more recent answer can be found here: http://robinlovelace.net/r/2013/11/26/installing-rgdal-on-ubuntu.html .
Essentially, the three following lines of code should sort it:
Spent ages on this problem, so hope this updated answer is useful to others. Let me know if so!
Try running them all together and specifying the versions, like this:
apt-get does not like to downgrade packages, but it will if you specify it.
Here in January 2016, on Ubuntu 14.04.2 (and with R 3.2.2), I needed the following to get both rgdal and the complementary (and frequently very useful) gdalUtils package installed:
Update: As on January 2017, the version of libgdal is 1i, so the second line of code should read:
Open terminal by pressing (Ctrl+alt+T) and type following command.
(It will fix dependencies.)
(removing Unnecessary packages)
(Clear cache)
To get rgdal to install on Ubuntu 12.04, I had to install (and hold) many version specific packages. Basically I tried each package and installed the required versions of the dependencies until I could work back up to the original goal, to install libgdal1-dev