[R-sig-Geo] Problem installing rgdal on linux CentOS 6

Roger Bivand Roger.Bivand at nhh.no
Mon Mar 3 19:47:58 CET 2014


On Mon, 3 Mar 2014, Gregory Duveiller wrote:

> Dear list,
>
> I am relatively new to linux and I am trying, unsuccesfully, to install
> 'rgdal' on a CentOS machine.
>
> When I type in R:
>
> $ install.packages('rgdal')

When istalling a source package with system dependencies that you are 
unsure that you meet, it does make a lot of sense to download the package 
from your CRAN mirror, and look in the inst/ directory for files offering 
help. Not only does the CRAN page for rgdal offer help:

SystemRequirements: for building from source: GDAL >= 1.6.3 library from 
http://trac.osgeo.org/gdal/wiki/DownloadSource and PROJ.4 (proj >= 4.4.9) 
from http://trac.osgeo.org/proj/; GDAL OSX frameworks built by William 
Kyngesburye at http://www.kyngchaos.com/ may be used for source installs 
on OSX.

but the source package includes an inst/README file. This explains in some 
detail which variants of binary packages might be needed to install the 
source package.

Always use what the package and its maintainer(s) say, never ever trust 
hearsay (on stackoverflow.com, on which I refuse to post, especially given 
its choice of gamifying). I do agree with the advice given on that so 
thread that you should prefer to install from source, but in the case of 
PROJ, you also need to download the other packages.

Reading the inst/README file, you'll see:

"If installing PROJ.4 from RPM binaries, note that four RPM files are
required: "proj", "proj-devel", "proj-epsg" and "proj-nad". The third and
fourth files, "proj-epsg" and "proj-nad", contain all of the support files
placed in /usr/share/proj, and are required for any use of "proj" itself."

so that, in addition to gdal and its -devel extra, you need several proj 
packages. The README file also notes that RPM and Debian packagers are 
fickle and things fall apart with depressing regularity, and/or users are 
consigned to using very out of date versions of PROJ and GDAL.

Learn to install system dependencies from source on systems where you have 
chosen to be in control. On OSX and Wndows, we/CRAN are in control, and 
sort things out for you.

>
> the installation stops with the following error:
>
> checking for proj_api.h... no
> configure: error: proj_api.h not found in standard or given locations.
> ERROR: configuration failed for package 'rgdal'
>
> I understand, from posts such as (
> http://stackoverflow.com/questions/15248815/rgdal-package-installation)
> that I need to install parts of GDAL and PROJ.4 from the terminal. But I do
> not understand which ones nor how to do so under CentOS. Currently I
> already ran these commands in the terminal:
>
> $ sudo yum install gdal
> $ sudo yum install proj
>

Actually, the so answerer wrote (for debian):

sudo apt-get install libgdal1-dev libproj-dev

which suggests gdal-devel, proj-devel, proj-nad, proj-epsg are needed too, 
and I don't think that they are installed. List the contents of proj and 
proj-devel, and you'll see that proj only lets you run the programs 
provided, but proj-devel provides the headers needed to compile and link 
other code to proj - that's why they are called -devel.

Bottom line, the help is in the inst/README file in the package, where one 
should expect to find it.

Hope this clarifies,

Roger

> And both resulted in the message Package xxx already installed and latest
> version
> Nothing to do
>
> Can anybody help?
>
> Thanks in advance and regards...
> Gregory Duveiller
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list