r-spatial / mapview

Interactive viewing of spatial data in R
https://r-spatial.github.io/mapview/
GNU General Public License v3.0
518 stars 91 forks source link

R crashes upon loading mapview library #375

Open aniruhil opened 3 years ago

aniruhil commented 3 years ago

loading mapview (version 2.9.0) crashes R. Not sure what is going on here but this is a plain vanilla session, no RStudio involved. Same result if I try dev version 2.9.1.

> library(mapview)

 *** caught segfault ***
address 0x4, cause 'memory not mapped'

Traceback:
 1: Module(module, mustStart = TRUE, where = env)
 2: doTryCatch(return(expr), name, parentenv, handler)
 3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 4: tryCatchList(expr, classes, parentenv, handlers)
 5: tryCatch(Module(module, mustStart = TRUE, where = env), error = function(e) e)
 6: loadModule(module = "spmod", what = TRUE, env = ns, loadNow = TRUE)
 7: (function (ns) loadModule(module = "spmod", what = TRUE, env = ns, loadNow = TRUE))(<environment>)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch((function (ns) loadModule(module = "spmod", what = TRUE, env = ns, loadNow = TRUE))(<environment>),     error = function(e) e)
12: eval(substitute(tryCatch(FUN(WHERE), error = function(e) e),     list(FUN = f, WHERE = where)), where)
13: eval(substitute(tryCatch(FUN(WHERE), error = function(e) e),     list(FUN = f, WHERE = where)), where)
14: .doLoadActions(where, attach)
15: methods::cacheMetaData(ns, TRUE, ns)
16: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
17: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()),     versionCheck = vI[[i]]), from = package)
18: loadNamespace(package, lib.loc)
19: doTryCatch(return(expr), name, parentenv, handler)
20: tryCatchOne(expr, names, parentenv, handlers[[1L]])
21: tryCatchList(expr, classes, parentenv, handlers)
22: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:\n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
23: library(mapview)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

sessionInfo() details follow:

> sessionInfo() R version 4.0.5 (2021-03-31) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 10.16 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.0.5

Thank you for any suggestions you may have!

tim-salabim commented 3 years ago

Does this only happen with mapview?

aniruhil commented 3 years ago

And geojsonio

tim-salabim commented 3 years ago

Hm, I've never come across this issue before. Sounds more like a general R setup issue to me... You could try to

remotes::install_github("r-spatial/mapview")

to see if that solves it (which I doubt).

aniruhil commented 3 years ago

Tried that but as you suspected, didn't help. Thanks anyway for trying to sort it out. I will poke around, maybe wipe clean and reinstall R. Oddly enough mapdeck works just fine, as do all sf, tmap, leaflet etc.

tim-salabim commented 3 years ago

Does running sf::sf_extSoftVersion() work?

aniruhil commented 3 years ago

Yes, this is the output:

> sf::sf_extSoftVersion()
          GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H 
       "3.9.1"        "3.2.2"        "7.2.1"         "true"         "true" 
          PROJ 
       "7.2.1" 

While I am waiting for 4.1 mac binary to be released next month, I thought I would try and set up a < 4.0 R package.

Installed mapview, dependencies, etc and it works. So the issue seems to be something about my R 4.0.5 installation. In case this tidbit helps.

EricKrantz commented 2 years ago

This was happening to me as well. Reinstalling terra fixed it.

ogletrees commented 1 year ago

I have R crashing with mapview too, but when this occurs it will also crash with terra, raster, and tmap. Will be investigating more but wanted to add that in case it is of any help. (Win 10, R 4.2.1) Update: I found that uninstalling and reinstalling Rcpp package allowed these to load without crashing the session

zjslagle commented 1 year ago

I had this same problem; @ogletrees suggestion (reinstall Rcpp) worked. Thanks!