Installing the R-package "rgeos" on linux: geos-config not found or not executable
Asked Answered
W

4

22

I am running R 3.4.1 on gentoo. When i try to install the 'rgeos' package, i get this:

> install.packages("rgeos")
Installing package into ‘/home/jody/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://stat.ethz.ch/CRAN/src/contrib/rgeos_0.4-2.tar.gz'
Content type 'application/x-gzip' length 255244 bytes (249 KB)
==================================================
downloaded 249 KB

* installing *source* package ‘rgeos’ ...
** package ‘rgeos’ successfully unpacked and MD5 sums checked
configure: CC: x86_64-pc-linux-gnu-gcc
configure: CXX: x86_64-pc-linux-gnu-g++
configure: rgeos: 0.4-2
checking for /usr/bin/svnversion... yes
configure: svn revision: 581
checking for geos-config... no
no
configure: error: geos-config not found or not executable.
ERROR: configuration failed for package ‘rgeos’
* removing ‘/home/jody/R/x86_64-pc-linux-gnu-library/3.4/rgeos’

The downloaded source packages are in
    ‘/tmp/RtmppEeDps/downloaded_packages’
Warning message:
In install.packages("rgeos") :
  installation of package ‘rgeos’ had non-zero exit status

(The same happens if i try to install rgeos on gentoo with R 3.5.1, and also on Centos 7.5 with R 3.5.1.)

While there is a rgeos/configure which is executable in the tar file mentioned above, there is indeed no geos-config in there.

How can i get the rgeos package installed?

Is there perhaps a binary version which i could download?

Weisberg answered 20/11, 2018 at 8:45 Comment(1)
From the package's DESCRIPTION: "The 'GEOS' library is external to the package, and, when installing the package from source, must be correctly installed first." The GEOS website is here, and they claim Gentoo has a binary package for GEOS, but right now the website seems to be down (see here)Oeuvre
Y
28

For Ubuntu (19.10 and likely onward) use:

sudo apt install libgeos-dev
Younker answered 26/5, 2020 at 12:25 Comment(2)
For Debian too! :)Draughtboard
Works for Ubuntu 22.04Prohibitory
W
17

I found the solution.

The "rgeos" package depends on libraries you have to install before running R.

In gentoo i had to do:

sudo emerge --ask sci-libs/geos

In CentOS:

sudo yum install geos geos-devel

After installing these libraries i started R and could install the 'rgeos' package without problems

Weisberg answered 20/11, 2018 at 8:57 Comment(6)
For Ubuntu (19.10) it's sudo apt install libgeos-devYounker
@Cyrille, you should make this an answer.Intermingle
Thanks @Droplet, but the OP is asking for Gentoo.Younker
In the question yes, but the title doesn't reflect this and this is one of the first link when you search 'rgeos linux' or even 'rgeos ubuntu'.Intermingle
I'm having this same issue and when I run sudo yum install geos geos-devel I get a "nothing to do" message because it's already installedPicco
for mac: brew install geosHandler
R
3

For Ubuntu 20.04, the solution is:

sudo apt install libgeos-dev
Rubble answered 29/6, 2020 at 0:46 Comment(1)
This has very little added value relative to @Cyrille's answer. It would have been better if you had just added this as a comment, saying that "yes, it works in 20.04, too".Selfregulated
A
-2

For Arch/Manjaro:

   sudo pacman -S geos
Allveta answered 15/3, 2021 at 10:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.