Knowing that the package rgeos, from the R language, requieres a prior installation of geos libraries, I installed, both, libgeos and libgeos-c1 (3.2.2), using the synaptic installer in my Ubuntu 12.04 (32 bit) machine.

Then I tried to install rgeos directly from the R console, and it issued a message in the sense that geos-config was not found. The output is as follows:

> install.packages("rgeos")
Installing package(s) into ‘/home/checo/R/i486-pc-linux-gnu-library/2.15’
(as ‘lib’ is unspecified)
also installing the dependency ‘sp’

probando la URL 'http://cran.rstudio.com/src/contrib/sp_1.0-9.tar.gz'
Content type 'application/x-gzip' length 882102 bytes (861 Kb)
URL abierta
downloaded 861 Kb

probando la URL 'http://cran.rstudio.com/src/contrib/rgeos_0.2-19.tar.gz'
Content type 'application/x-gzip' length 221471 bytes (216 Kb)
URL abierta
downloaded 216 Kb

* installing *source* package ‘sp’ ...
** package ‘sp’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c R    centroid.c -o Rcentroid.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c gcdist.c -o gcdist.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c pip.c -o pip.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c pip2.c -o pip2.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c sp_xports.c -o sp_xports.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c surfaceArea.c -o surfaceArea.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c zerodist.c -o zerodist.o
gcc -std=gnu99 -shared -o sp.so Rcentroid.o gcdist.o init.o pip.o pip2.o sp_xports.o surfaceArea.o zerodist.o -L/usr/lib/R/lib -lR
installing to /home/checo/R/i486-pc-linux-gnu-library/2.15/sp/libs
** R
** data
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded

* DONE (sp)
* installing *source* package ‘rgeos’ ...
** package ‘rgeos’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgeos: 0.2-17
checking for /usr/bin/svnversion... no
configure: svn revision: 394
checking geos-config usability... 
./configure: line 1385: geos-config: command not found
configure: error: geos-config not usable
ERROR: configuration failed for package ‘rgeos’
* removing ‘/home/checo/R/i486-pc-linux-gnu-library/2.15/rgeos’
Warning in install.packages :
  installation of package ‘rgeos’ had non-zero exit status

Forgive my ignorance, but I don't know where this file, "geos-config", comes from: should it be generated by the gcc compilations above, or should it be previously installed when the libgeos libraries were intalled?

I learnt, from another machine, that "geos-config" is an executable and that it should be installed in /usr/bin.

Do you have any idea on what's wrong with my procedure?




Install the libgeos-dev Install libgeos-dev package with your favourite package manager (or software centre) and you'll have /usr/bin/geos-config.

How did I find this? I used the query geos-config for files on the http://packages.ubuntu.com/ webpage. This will list the package you need (query link). Use this next time when you run into similar issues!

  • 1
    You can also use the nice tool apt-file for looking up files in the ubuntu repo. Eg. apt-file search geos-config will give you an exact match to libgeos-dev. – ortang Jun 24 '13 at 23:43
  • Thanks! I did as you recommended, and the R package "rgeos" was also installed without a problem. – JulioSergio Jun 25 '13 at 15:25

Since the OP doesn't name a specific distribution, here is the line I needed to install goes-config on CENTOS (e.g., RHEL & Amazon Linux): yum install -y geos-devel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.