mapview icon indicating copy to clipboard operation
mapview copied to clipboard

R crashes upon loading mapview library

Open aniruhil opened this issue 4 years ago • 9 comments

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!

aniruhil avatar Apr 19 '21 11:04 aniruhil

Does this only happen with mapview?

tim-salabim avatar Apr 19 '21 12:04 tim-salabim

And geojsonio

aniruhil avatar Apr 19 '21 12:04 aniruhil

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).

tim-salabim avatar Apr 19 '21 12:04 tim-salabim

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.

aniruhil avatar Apr 19 '21 12:04 aniruhil

Does running sf::sf_extSoftVersion() work?

tim-salabim avatar Apr 24 '21 16:04 tim-salabim

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.

aniruhil avatar Apr 24 '21 17:04 aniruhil

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

EricKrantz avatar Jul 09 '22 20:07 EricKrantz

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

ogletrees avatar Nov 07 '22 16:11 ogletrees

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

zjslagle avatar Jan 18 '23 14:01 zjslagle