Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDAL Erorr 4: Unable to open EPSG support file gcs.csv. #1211

Closed
erstearns opened this issue Dec 5, 2019 · 10 comments
Closed

GDAL Erorr 4: Unable to open EPSG support file gcs.csv. #1211

erstearns opened this issue Dec 5, 2019 · 10 comments

Comments

@erstearns
Copy link

I have a Shiny app that sets the crs of sf objects. This has been running fine until I pushed to the shinyio server as well as an AWS Linux server where I encountered the following error: Warning: Error in CPL_transform: OGR error. I went into the code to check the error on my local machine, running Ubuntu 18.04.3 (further system details below) and now my Shiny app does not work locally either and I am running into the following error after running st_transform on an sf object(
state_bounds <- st_transform(state_bounds, crs = 4326)):

Warning in CPL_crs_from_epsg(as.integer(x)) : GDAL Error 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files. OGR: Corrupt data Error in CPL_transform(x, crs$proj4string) : OGR error

I set the GDAL_DATA environment variable and still received the same error.

I then re-installed RGDAL, and sf and ran into this error pertaining to a tmap call in a downloadable report (.Rmd) file:

Warning: Error in : package or namespace load failed for 'tmap' in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/e/Dropbox/R_lib/3.6/lwgeom/libs/lwgeom.so':
  libproj.so.13: cannot open shared object file: No such file or directory
  [No stack trace available]

When I try to check my versions of geospatial libraries, GEOS and GDAL return version info (see below) but PROJ returns the following:

Rel. 6.2.1, November 1st, 2019
<proj>: 
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated

I am truly bamboozled by this sequence of events because I literally changed nothing from yesterday and everything ran great. My questions are:

  1. Has there been some sort of update to any packages or libraries in the past 24 hours that would somehow auto-install?
  2. What is the best path forward to resolving this issue?

Thank you in advance for your help.

Geospatial libraries version information:
GDAL version: GDAL 3.0.2, released 2019/10/28
GEOS version: 3.8.0

Session information:

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] forcats_0.4.0        purrr_0.3.3          readr_1.3.1         
 [4] tidyr_1.0.0          tibble_2.1.3         tidyverse_1.2.1     
 [7] scales_1.0.0         rmarkdown_1.16       DT_0.9              
[10] png_0.1-7            RColorBrewer_1.1-2   plotly_4.9.0.9000   
[13] ggplot2_3.2.1        leaflet.extras_1.0.0 leaflet_2.0.2       
[16] data.table_1.12.6    dplyr_0.8.3          gstat_2.0-3         
[19] raster_3.0-7         sf_0.8-0             rgdal_1.4-8         
[22] sp_1.3-1             stringr_1.4.0        V8_2.3              
[25] shinyWidgets_0.4.9   rintrojs_0.2.2       shinyjs_1.0         
[28] reactlog_1.0.0       shiny_1.4.0         

loaded via a namespace (and not attached):
 [1] nlme_3.1-142       xts_0.11-2         lubridate_1.7.4   
 [4] httr_1.4.1         tools_3.6.1        backports_1.1.5   
 [7] R6_2.4.0           KernSmooth_2.23-16 DBI_1.0.0         
[10] lazyeval_0.2.2     colorspace_1.4-1   withr_2.1.2       
[13] tidyselect_0.2.5   curl_4.2           compiler_3.6.1    
[16] cli_1.1.0          rvest_0.3.4        xml2_1.2.2        
[19] labeling_0.3       classInt_0.4-1     askpass_1.1       
[22] digest_0.6.22      dichromat_2.0-0    pkgconfig_2.0.3   
[25] htmltools_0.4.0    fastmap_1.0.1      readxl_1.3.1      
[28] htmlwidgets_1.5.1  rlang_0.4.1        rstudioapi_0.10   
[31] FNN_1.1.3          generics_0.0.2     zoo_1.8-6         
[34] jsonlite_1.6       crosstalk_1.0.0    magrittr_1.5      
[37] Rcpp_1.0.2         munsell_0.5.0      lifecycle_0.1.0   
[40] leafsync_0.1.0     stringi_1.4.3      yaml_2.2.0        
[43] grid_3.6.1         promises_1.1.0     crayon_1.3.4      
[46] fortunes_1.5-4     lattice_0.20-38    haven_2.1.1       
[49] hms_0.5.1          zeallot_0.1.0      knitr_1.25        
[52] pillar_1.4.2       spacetime_1.2-2    codetools_0.2-16  
[55] XML_3.98-1.20      glue_1.3.1         packrat_0.5.0     
[58] evaluate_0.14      modelr_0.1.5       vctrs_0.2.0       
[61] httpuv_1.5.2       cellranger_1.1.0   gtable_0.3.0      
[64] openssl_1.4.1      assertthat_0.2.1   xfun_0.10         
[67] mime_0.7           xtable_1.8-4       broom_0.5.2       
[70] e1071_1.7-2        later_1.0.0        rsconnect_0.8.15  
[73] class_7.3-15       viridisLite_0.3.0  intervals_0.15.1  
[76] units_0.6-5   

@edzer
Copy link
Member

edzer commented Dec 5, 2019

On your system, several R packages (rgdal, sf, lwgeom) link to external libraries (GDAL, GEOS and/or PROJ). It sounds like (some of) these libraries were updated after installing the R packages, and at that point you often need to reinstall the R packages involved. Have you tried reinstalling lwgeom?

@Robinlovelace
Copy link
Contributor

Heads-up I just hit this issue after updating GDAL on my system. Details to follow in case it's of use to others...

@Robinlovelace
Copy link
Contributor

Reprex showing my set-up below. Next step: try re-installing the packages as suggested...:

library(sf)
#> Linking to GEOS 3.8.0, GDAL 2.4.2, PROJ 5.2.0
#> WARNING: different compile-time and runtime versions for GEOS found:
#> Linked against: 3.8.0-CAPI-1.13.1  compiled against: 3.7.1-CAPI-1.11.1
#> It is probably a good idea to reinstall sf, and maybe rgeos and rgdal too
library(spData)
data("us_states", package = "spData")
north_carolina = read_sf(system.file("shape/nc.shp", package = "sf"))
#> Warning in CPL_read_ogr(dsn, layer, query, as.character(options), quiet, : GDAL
#> Error 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA
#> environment variable to point to the directory containing EPSG csv files.
us_states_2163 = st_transform(us_states, crs = 2163)
#> Warning in CPL_crs_from_epsg(as.integer(x)): GDAL Error 4: Unable to open EPSG
#> support file gcs.csv. Try setting the GDAL_DATA environment variable to point to
#> the directory containing EPSG csv files.
#> OGR: Corrupt data
#> Error in CPL_transform(x, crs$proj4string): OGR error
north_carolina_2163 = st_transform(north_carolina, crs = 2163)
#> Warning in CPL_crs_from_epsg(as.integer(x)): GDAL Error 4: Unable to open EPSG
#> support file gcs.csv. Try setting the GDAL_DATA environment variable to point to
#> the directory containing EPSG csv files.
#> OGR: Corrupt data
#> Error in CPL_transform(x, crs$proj4string): OGR error

Created on 2019-12-06 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Ubuntu 18.04.3 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language en_GB:en                    
#>  collate  en_GB.UTF-8                 
#>  ctype    en_GB.UTF-8                 
#>  tz       Europe/London               
#>  date     2019-12-06                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date       lib source                              
#>  assertthat    0.2.1   2019-03-21 [2] CRAN (R 3.6.0)                      
#>  backports     1.1.5   2019-10-02 [1] CRAN (R 3.6.1)                      
#>  callr         3.3.2   2019-09-22 [1] CRAN (R 3.6.1)                      
#>  class         7.3-15  2019-01-01 [2] standard (@7.3-15)                  
#>  classInt      0.4-3   2019-12-04 [1] Github (r-spatial/classInt@7bc8a82) 
#>  cli           1.1.0   2019-03-19 [2] CRAN (R 3.5.3)                      
#>  crayon        1.3.4   2017-09-16 [2] standard (@1.3.4)                   
#>  DBI           1.0.0   2018-05-02 [2] CRAN (R 3.5.2)                      
#>  desc          1.2.0   2018-05-01 [2] standard (@1.2.0)                   
#>  devtools      2.2.1   2019-09-24 [1] CRAN (R 3.6.1)                      
#>  digest        0.6.23  2019-11-23 [1] CRAN (R 3.6.1)                      
#>  e1071         1.7-3   2019-11-26 [2] CRAN (R 3.6.1)                      
#>  ellipsis      0.3.0   2019-09-20 [1] CRAN (R 3.6.1)                      
#>  evaluate      0.14    2019-05-28 [2] CRAN (R 3.6.0)                      
#>  fs            1.3.1   2019-05-06 [2] CRAN (R 3.6.0)                      
#>  glue          1.3.1   2019-03-12 [2] CRAN (R 3.5.3)                      
#>  highr         0.8     2019-03-20 [3] CRAN (R 3.5.3)                      
#>  htmltools     0.4.0   2019-10-04 [3] CRAN (R 3.6.1)                      
#>  KernSmooth    2.23-16 2019-10-15 [4] CRAN (R 3.6.1)                      
#>  knitr         1.26    2019-11-12 [1] CRAN (R 3.6.1)                      
#>  magrittr      1.5     2014-11-22 [2] CRAN (R 3.5.2)                      
#>  memoise       1.1.0   2017-04-21 [3] CRAN (R 3.5.0)                      
#>  pillar        1.4.2   2019-06-29 [2] CRAN (R 3.6.0)                      
#>  pkgbuild      1.0.6   2019-10-09 [2] CRAN (R 3.6.1)                      
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 3.6.1)                      
#>  pkgload       1.0.2   2018-10-29 [3] CRAN (R 3.5.1)                      
#>  prettyunits   1.0.2   2015-07-13 [2] CRAN (R 3.5.3)                      
#>  processx      3.4.1   2019-07-18 [2] CRAN (R 3.6.1)                      
#>  ps            1.3.0   2018-12-21 [2] CRAN (R 3.5.3)                      
#>  R6            2.4.1   2019-11-12 [1] CRAN (R 3.6.1)                      
#>  Rcpp          1.0.3   2019-11-08 [1] CRAN (R 3.6.1)                      
#>  remotes       2.1.0   2019-06-24 [1] CRAN (R 3.6.1)                      
#>  rlang         0.4.2   2019-11-23 [1] CRAN (R 3.6.1)                      
#>  rmarkdown     1.18    2019-11-27 [1] CRAN (R 3.6.1)                      
#>  rprojroot     1.3-2   2018-01-03 [2] CRAN (R 3.5.3)                      
#>  sessioninfo   1.1.1   2018-11-05 [3] CRAN (R 3.5.1)                      
#>  sf          * 0.8-0   2019-09-17 [1] CRAN (R 3.6.1)                      
#>  spData      * 0.3.2   2019-09-19 [1] CRAN (R 3.6.1)                      
#>  spDataLarge   0.3.1   2019-05-29 [2] Github (nowosad/spDataLarge@012fe53)
#>  stringi       1.4.3   2019-03-12 [2] CRAN (R 3.5.3)                      
#>  stringr       1.4.0   2019-02-10 [2] standard (@1.4.0)                   
#>  testthat      2.3.0   2019-11-05 [2] CRAN (R 3.6.1)                      
#>  tibble        2.1.3   2019-06-06 [2] CRAN (R 3.6.0)                      
#>  units         0.6-5   2019-10-08 [1] CRAN (R 3.6.1)                      
#>  usethis       1.5.1   2019-07-04 [1] CRAN (R 3.6.1)                      
#>  withr         2.1.2   2018-03-15 [2] CRAN (R 3.5.3)                      
#>  xfun          0.11    2019-11-12 [1] CRAN (R 3.6.1)                      
#>  yaml          2.2.0   2018-07-25 [3] CRAN (R 3.5.1)                      
#> 
#> [1] /home/robin/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library

@Robinlovelace
Copy link
Contributor

Updating all the relevant packages with:

remotes::install_cran("sf", force = TRUE)
remotes::install_cran("rgdal", force = TRUE)
remotes::install_cran("rgeos", force = TRUE)
remotes::install_cran("lwgeom", force = TRUE)

@Robinlovelace
Copy link
Contributor

Good news: after re-installing those packages, it works! Thanks for reporting the issue @erstearns and the quickfire info on how to fix it.

library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.2, PROJ 6.2.1
library(spData)
data("us_states", package = "spData")
north_carolina = read_sf(system.file("shape/nc.shp", package = "sf"))
us_states_2163 = st_transform(us_states, crs = 2163)
north_carolina_2163 = st_transform(north_carolina, crs = 2163)

Created on 2019-12-06 by the reprex package (v0.3.0)

@edzer
Copy link
Member

edzer commented Dec 6, 2019

@Robinlovelace which OS & version is this?

@Robinlovelace
Copy link
Contributor

See the details in the session info above:

image

@Robinlovelace
Copy link
Contributor

Ubuntu, same as @erstearns by the looks of it. Auto update from ubuntugis-unstable:

egrep -v '^#|^ *$' /etc/apt/sources.list /etc/apt/sources.list.d/* | grep gis
/etc/apt/sources.list:deb https://qgis.org/ubuntugis bionic main
/etc/apt/sources.list:deb-src https://qgis.org/ubuntugis bionic main
/etc/apt/sources.list.d/ubuntugis-ubuntu-ubuntugis-unstable-bionic.list:deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu bionic main
/etc/apt/sources.list.d/ubuntugis-ubuntu-ubuntugis-unstable-bionic.list.save:deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu bionic main

@edzer
Copy link
Member

edzer commented Dec 6, 2019

Thanks; so Ubuntu LTS with PPA ubuntugis-unstable (our recommended r-spatial Ubuntu platform) is now on GDAL 3.0.2 and PROJ 6.2.1. Also relevant for r-spatial/discuss#28 and #1033

@erstearns
Copy link
Author

Woohoo! Thank you @edzer and @Robinlovelace ! My app is alive and well again :) Thank you for your swift problem-solving and help with this!

@edzer edzer closed this as completed Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants