stan-dev / shinystan

shinystan R package and ShinyStan GUI
https://mc-stan.org/shinystan
GNU General Public License v3.0
197 stars 51 forks source link

R 3.2.3 Crashes on OS X 10.11.3 when loading shinystan #112

Closed rubgb closed 4 years ago

rubgb commented 8 years ago

I have problems running the CRAN version of shinystan. When I try to load the library, I get the following result:

library(shinystan) Loading required package: shiny

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

Traceback: 1: dyn.load(file, DLLpath = DLLpath, ...) 2: library.dynam(lib, package, package.lib) 3: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) 4: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]), from = package) 5: loadNamespace(package, c(which.lib.loc, lib.loc)) 6: doTryCatch(return(expr), name, parentenv, handler) 7: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8: tryCatchList(expr, classes, parentenv, handlers) 9: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { cat(msg, file = stderr()) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 10: try({ ns <- loadNamespace(package, c(which.lib.loc, lib.loc)) env <- attachNamespace(ns, pos = pos, deps)}) 11: library(shinystan)

I can load shiny fine. Any suggestions? Many thanks in advance, Ruben

jgabry commented 8 years ago

I don't think this is a shinystan issue per se, but rather something to do with one of the other packages being loaded as a side effect. A package that needs dynload. What happens if you try to load rstan (without loading shinystan first)?

On Thursday, January 28, 2016, rubgb notifications@github.com wrote:

I have problems running the CRAN version of shinystan When I try to load the library, I get the following result:

library(shinystan) Loading required package: shiny

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

Traceback: 1: dynload(file, DLLpath = DLLpath, ) 2: librarydynam(lib, package, packagelib) 3: loadNamespace(i, c(libloc, libPaths()), versionCheck = vI[[i]]) 4: namespaceImport(ns, loadNamespace(i, c(libloc, libPaths()), versionCheck = vI[[i]]), from = package) 5: loadNamespace(package, c(whichlibloc, libloc)) 6: doTryCatch(return(expr), name, parentenv, handler) 7: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8: tryCatchList(expr, classes, parentenv, handlers) 9: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!isnull(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- syscall(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (isna(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("showerrormessages"), TRUE)) { cat(msg, file = stderr()) Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e) )}) 10: try({ ns <- loadNamespace(package, c(whichlibloc, libloc)) env <- attachNamespace(ns, pos = pos, deps)}) 11: library(shinystan)

I can load shiny fine Any suggestions? Many thanks in advance, Ruben

— Reply to this email directly or view it on GitHub https://github.com/stan-dev/shinystan/issues/112.

jgabry commented 8 years ago

@rubgb Are you still having this problem? If not I'll close this issue, but if this is still a problem can you check if installing the new release of rstan from CRAN (version 2.9.0-3) helps?

rubgb commented 8 years ago

I'm still having the same problem after updating rstan and rstan-arm to the latest release from CRAN.

On Monday, February 15, 2016 4:22 AM, Jonah Gabry <notifications@github.com> wrote:

@rubgb Are you still having this problem? If not I'll close this issue, but if this is still a problem can you check if installing the new release of rstan from CRAN (version 2.9.0-3) helps?— Reply to this email directly or view it on GitHub.

jgabry commented 8 years ago

Do rstan and rstanarm work properly and just shinystan causes this error? Or do rstan and/or rstanarm also give you this (or a similar) error?

rubgb commented 8 years ago

rstan works fine but rstanarm gives a similar error

On Friday, February 19, 2016 2:39 AM, Jonah Gabry <notifications@github.com> wrote:

Do rstan and rstanarm work properly and just shinystan causes this error? Or do rstan and/or rstanarm also give you this (or a similar) error?— Reply to this email directly or view it on GitHub.

jgabry commented 8 years ago

Hmm, sorry you're still running into this problem. I'm not sure what's going on. I'm running the same versions of R and OS X as you are and everything is fine, so I don't think either of those is the issue. Out of curiosity, does the same thing happen both with and without using RStudio? I doubt that's the issue, but I'm not sure where else to look.

On Thursday, February 18, 2016, rubgb notifications@github.com wrote:

rstan works fine but rstanarm gives a similar error

On Friday, February 19, 2016 2:39 AM, Jonah Gabry < notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

Do rstan and rstanarm work properly and just shinystan causes this error? Or do rstan and/or rstanarm also give you this (or a similar) error?— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/stan-dev/shinystan/issues/112#issuecomment-186024433.

vbonhomme commented 8 years ago

Hi there, I had pretty much the same problem and reinstalling Rcpp from the terminal, solved the problem. Do not ask me why in detail though. hth

jgabry commented 8 years ago

Thanks @vbonhomme. I'm not sure why either, but I'm glad that worked for you.

@rubgb Does that also solve this issue for you?

rubgb commented 8 years ago

Unfortunately it's not working. I reinstalled Rcpp from source from the command line but when I tried the same with shinystan 2.1.0 (R CMD INSTALL shinystan_2.1.0.tar.gz) I got the following error messages:

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

Traceback:  1: dyn.load(file, DLLpath = DLLpath, ...)  2: library.dynam(lib, package, package.lib)  3: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])  4: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()),     versionCheck = vI[[i]]), from = package)  5: loadNamespace(package, lib.loc, keep.source, partial = TRUE)  6: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))  7: suppressPackageStartupMessages(loadNamespace(package, lib.loc,     keep.source, partial = TRUE))  8: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source,     compress = compress)  9: makeLazyLoading(pkg_name, lib, keep.source = keep.source) 10: doTryCatch(return(expr), name, parentenv, handler) 11: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 12: tryCatchList(expr, classes, parentenv, handlers) 13: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <- conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = stderr())        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))}) 14: try({    suppressPackageStartupMessages(.getRequiredPackages(quietly = TRUE))    makeLazyLoading(pkg_name, lib, keep.source = keep.source)}) 15: do_install_source(pkg_name, instdir, pkg, desc) 16: do_install(pkg) 17: tools:::.install_packages() aborting ... /Library/Frameworks/R.framework/Resources/bin/INSTALL: line 34:  2669 Done                    echo 'tools:::.install_packages()'       2670 Segmentation fault: 11  | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --slave --args ${args}

On Monday, March 7, 2016 10:35 PM, Jonah Gabry <notifications@github.com> wrote:

Thanks @vbonhomme. I'm not sure why either, but I'm glad that worked for you.@rubgb Does that also solve this issue for you?— Reply to this email directly or view it on GitHub.

jgabry commented 8 years ago

I'm really sorry it's still not working for you. Unfortunately I'm not able to reproduce the error -- even with the same OS, same versions of R and packages -- so it's been very hard to figure out what's going wrong.

On Monday, March 7, 2016, rubgb notifications@github.com wrote:

Unfortunately it's not working. I reinstalled Rcpp from source from the command line but when I tried the same with shinystan 2.1.0 (R CMD INSTALL shinystan_2.1.0.tar.gz) I got the following error messages:

  • installing to library ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library’
  • installing source package ‘shinystan’ ... * package ‘shinystan’ successfully unpacked and MD5 sums checked * R \ data ** moving datasets to lazyload DB * inst \ preparing package for lazy loading

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

Traceback: 1: dyn.load(file, DLLpath = DLLpath, ...) 2: library.dynam(lib, package, package.lib) 3: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) 4: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]), from = package) 5: loadNamespace(package, lib.loc, keep.source, partial = TRUE) 6: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage")) 7: suppressPackageStartupMessages(loadNamespace(package, lib.loc, keep.source, partial = TRUE)) 8: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source, compress = compress) 9: makeLazyLoading(pkg_name, lib, keep.source = keep.source) 10: doTryCatch(return(expr), name, parentenv, handler) 11: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 12: tryCatchList(expr, classes, parentenv, handlers) 13: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { cat(msg, file = stderr()) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 14: try({ suppressPackageStartupMessages(.getRequiredPackages(quietly = TRUE)) makeLazyLoading(pkg_name, lib, keep.source = keep.source)}) 15: do_install_source(pkg_name, instdir, pkg, desc) 16: do_install(pkg) 17: tools:::.install_packages() aborting ... /Library/Frameworks/R.framework/Resources/bin/INSTALL: line 34: 2669 Done echo 'tools:::.install_packages()' 2670 Segmentation fault: 11 | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --slave --args ${args}

On Monday, March 7, 2016 10:35 PM, Jonah Gabry <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

Thanks @vbonhomme. I'm not sure why either, but I'm glad that worked for you.@rubgb Does that also solve this issue for you?— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/stan-dev/shinystan/issues/112#issuecomment-193552980.