3

I have a shiny app that runs fine on my computer. I use packages sf, leaflet, and tmap. One of these requires the package lwgeom as a dependency. While installing the package lwgeom, shiny deployment gives me the following error message. What is GEOS? And how can I upgrade GEOS to 3.6.0 or later?

Building R package: lwgeom (0.2-4)

/mnt/packages/build /mnt

* installing to library ‘/opt/R/4.0.0/lib/R/library’

* installing *source* package ‘lwgeom’ ...

** package ‘lwgeom’ successfully unpacked and MD5 sums checked

** using staged installation

configure: CC: gcc

configure: CXX: g++ -std=gnu++11

configure: pkg-config proj exists, will use it

configure: PROJ: 4.9.2

checking for pj_init_plus in -lproj... yes

checking PROJ: epsg found and readable... yes

configure: POSTGIS_PROJ_VERSION: 49

checking for geos-config... /usr/bin/geos-config

checking geos-config usability... yes

configure: GEOS: 3.5.1

checking GEOS version >= 3.6.0... no

configure: error: upgrade GEOS to 3.6.0 or later

ERROR: configuration failed for package ‘lwgeom’

* removing ‘/opt/R/4.0.0/lib/R/library/lwgeom’

################################# End Task Log ################################# 
Error: Unhandled Exception: Child Task 741115836 failed: Error building image: Error building lwgeom (0.2-4). Build exited with non-zero status: 1
Execution halted  
user49017
  • 137
  • 1
  • 6

2 Answers2

1

Update: I notified shinyapps.io and after several weeks they upgraded to to GEOS 3.8.0. So, now my app deploys fine.

user49017
  • 137
  • 1
  • 6
0

From the lwgeom readme:

lwgeom depends on sf, which has to be installed first. This package uses the liblwgeom library, and compiles a shipped (and modified) version of liblwgeom. It links to the GEOS and PROJ libraries.

To install from source, it should be enough to have installed sf from source; the resources for this package (PROJ, GEOS) are being reused.

From the sf homepage

Simple Features for R

A package that provides simple features access for R. Package sf:

[snip]

  • interfaces to GEOS to support geometrical operations including the DE9-IM

That should answer your "What is GEOS?" question, but you might want to visit the GEOS homepage for a longer version.

In any case, you seem to be building lwgeom from source on Linux, so do read its install-from-source instructions. You'll probably want to upgrade the libgeos-dev system package, but the procedure to do so depends on your linux distribution. Let me quote the sf homepage once again, assuming you're running Ubuntu as your distro:

Ubuntu

[snip]

However, to get more up-to-date versions of dependencies such as GDAL, we recommend adding the ubuntugis-unstable PPA to the package repositories and installing them as follows:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev 

(It should be obvious that a different distro shall require a different method to install/upgrade system packages)

Community
  • 1
  • 1
IvanSanchez
  • 18,272
  • 3
  • 30
  • 45
  • Thanks. This helps me understand the issue better, but my shiny app is still failing to load. I am building the shiny app on windows. I have `sf` installed and it links to GEOS 3.8.0, GDAL 3.0.4, and PROJ 6.3.1. I also have `lwgeom` installed and it links to liblwgeom 3.0.0beta1 r16016, GEOS 3.8.0, and PROJ 6.3.1. When I try to load the package to shinyapps.io is when problems start. I think shinyapps.io is built with Ubuntu Linux as operating system. Note that the error indicates that I upgrade GEOS to 3.6.0 or later while `sf` links to GEOS 3.8.0! – user49017 Jun 03 '20 at 10:59
  • I have the same issue. Also this question probably reduped elsewhere. edit; here -- https://stackoverflow.com/questions/62097231/upgrade-geos-version-on-shiny-apps-io/62165224 – Mach5RacerGoGo Jun 10 '20 at 10:28