[R-SIG-Mac] R crashes after installing certain packages

Rainer M Krug Rainer at krugs.de
Mon Nov 14 09:26:12 CET 2016


"Charabuddi, Chaitanya Krishna Reddy" <cxc155530 at utdallas.edu> writes:

> Hello,
>
> I’m running R (3.3.1) with R-Studio (0.99.903) and Xquatrz (2.7.11) on my Macbook Pro with macOS Sierra (10.12.1).
>
> I’m facing a weird problem, after installing basic packages such as –
> car, plyr, etc. They get installed just fine when I use
> install.packages() command but the problem comes when I’m calling the
> package using library() command. As soon as I run this command (ex:
> library(car)), R crashes and I have to restart R again. I tried
> installing and re-installing all the applications (R, R-studio and
> X-Quartz) but can’t get around the problem.
>
> Can you please help me?

1) You are asking about R-studio which is different GUI - so if you want
to get this solved, w=you have to ask on their mailing list.

Now to your problem: 

R-GUI: R for 3.2.4 GUI 1.67 Mavericks build (7152)


In R console: I can load the package car
In RStudio  : I can load the package car
in R-GUI    : R crashes with the following info:

,----
| > sessionInfo()
| R version 3.3.2 (2016-10-31)
| Platform: x86_64-apple-darwin16.1.0 (64-bit)
| Running under: macOS Sierra 10.12.1
| 
| 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     
| > library(car)
| 
|  *** caught segfault ***
| address 0x18, cause 'memory not mapped'
| 
| Traceback:
|  1: dyn.load(file, DLLpath = DLLpath, ...)
|  2: library.dynam(lib, package, package.lib)
|  3: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
|  4: asNamespace(ns)
|  5: namespaceImportFrom(ns, loadNamespace(j <- i[[1L]], c(lib.loc,     .libPaths()), versionCheck = vI[[j]]), i[[2L]], from = package)
|  6: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
|  7: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()),     versionCheck = vI[[i]]), from = package)
|  8: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
|  9: asNamespace(ns)
| 10: namespaceImportFrom(ns, loadNamespace(j <- i[[1L]], c(lib.loc,     .libPaths()), versionCheck = vI[[j]]), i[[2L]], from = package)
| 11: loadNamespace(package, lib.loc)
| 12: doTryCatch(return(expr), name, parentenv, handler)
| 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
| 14: tryCatchList(expr, classes, parentenv, handlers)
| 15: 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))})
| 16: try({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps)})
| 17: library(car)
| 
| Possible actions:
| 1: abort (with core dump, if enabled)
| 2: normal R exit
| 3: exit R without saving workspace
| 4: exit R saving workspace
| Selection:
`----

Trying to re-install car in R-GUI gives the following error:

,----
| > install.packages("car")
| Installing package into ‘/Users/rainerkrug/Library/R/3.3/library’
| (as ‘lib’ is unspecified)
| trying URL 'http://cran.univ-paris1.fr/src/contrib/car_2.1-3.tar.gz'
| Content type 'application/x-gzip' length 622922 bytes (608 KB)
| ==================================================
| downloaded 608 KB
| 
| * installing *source* package ‘car’ ...
| ** package ‘car’ successfully unpacked and MD5 sums checked
| ** R
| ** data
| *** moving datasets to lazyload DB
| ** inst
| ** byte-compile and prepare 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(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
|  4: asNamespace(ns)
|  5: namespaceImportFrom(ns, loadNamespace(j <- i[[1L]], c(lib.loc,     .libPaths()), versionCheck = vI[[j]]), i[[2L]], from = package)
|  6: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
|  7: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()),     versionCheck = vI[[i]]), from = package)
|  8: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
|  9: asNamespace(ns)
| 10: namespaceImportFrom(ns, loadNamespace(j <- i[[1L]], c(lib.loc,     .libPaths()), versionCheck = vI[[j]]), i[[2L]], from = package)
| 11: loadNamespace(package, lib.loc, keep.source, partial = TRUE)
| 12: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
| 13: suppressPackageStartupMessages(loadNamespace(package, lib.loc,     keep.source, partial = TRUE))
| 14: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source,     compress = compress)
| 15: makeLazyLoading(pkg_name, lib, keep.source = keep.source)
| 16: doTryCatch(return(expr), name, parentenv, handler)
| 17: tryCatchOne(expr, names, parentenv, handlers[[1L]])
| 18: tryCatchList(expr, classes, parentenv, handlers)
| 19: 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))})
| 20: try({    suppressPackageStartupMessages(.getRequiredPackages(quietly = TRUE))    makeLazyLoading(pkg_name, lib, keep.source = keep.source)})
| 21: do_install_source(pkg_name, instdir, pkg, desc)
| 22: do_install(pkg)
| 23: tools:::.install_packages()
| The downloaded source packages are in
| 	‘/private/var/folders/50/wcr5bjwn75q595n6x82gxj280000gn/T/RtmpK6Dn5L/downloaded_packages’
| 
| An irrecoverable exception occurred. R is aborting now ...
| Warning message:
| In install.packages("car") :
|   installation of package ‘car’ had non-zero exit status
| /usr/local/Cellar/r/3.3.2/R.framework/Resources/bin/INSTALL: line 34: 64396 Done                    echo 'tools:::.install_packages()'
|      64397 Segmentation fault: 11  | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --slave --args ${args}
| > 
`----

So something is not proper here.

In general: trying to load a package which is not present results in a
segfault:

,----
| > library(fff)
| Error in library(fff) : there is no package called ‘fff’
| 
|  *** caught segfault ***
| address 0x18, cause 'memory not mapped'
| 
| Possible actions:
| 1: abort (with core dump, if enabled)
| 2: normal R exit
| 3: exit R without saving workspace
| 4: exit R saving workspace
| Selection:
`----

R, R-GUI, and RStudio are all installed using homebrew.

I can do further tests if needed.

Cheers,

Rainer

>
> Note: I’m not very technically sound in these issues and a solution
> explained in a layman language will be much appreciated.
>
> Thanks,
> Chaitanya
> Graduate student
> MS in Business Analytics
> University of Texas at Dallas
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 454 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20161114/3dcbbdb4/attachment.bin>


More information about the R-SIG-Mac mailing list