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

I am running a pipeline that uses R on terminal to run a script:
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.3
I suddenly get this error. I have checked other users errors and tried to uninstall and install the packages using
ip <- installed.packages() pkgs.to.remove <- ip[!(ip[,"Priority"] %in%
c("base", "recommended")), 1] sapply(pkgs.to.remove, remove.packages)
but it does not work and I keep having the same error. Could you give me a hand trying to guess how I could fix this?
many thanks
EC
*** caught segfault ***
address 0x18, cause 'memory not mapped'
Traceback:
1: dyn.load(file, DLLpath = DLLpath, ...)
2: library.dynam(lib, package, package.lib)
3: loadNamespace(package, lib.loc)
4: doTryCatch(return(expr), name, parentenv, handler)
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: tryCatchList(expr, classes, parentenv, handlers)
7: tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps)}, 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)})
8: library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc, quietly = quietly)
9: .getRequiredPackages2(pkgInfo, quietly = quietly)
10: library(DESeq2)
11: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
12: suppressPackageStartupMessages({ library(DESeq2)})
An irrecoverable exception occurred. R is aborting now ...
'Rscript /Users/user1/samsa2/R_scripts/run_DESeq_stats.R -I /Volumes/ECG_WORK/JC150_T0/results/step_5_output/RefSeq_results/org_results -O RefSeq_org_DESeq_results.tab -R /Volumes/ECG_WORK/JC150_T0/results/step_2_output/raw_counts.txt' exited with non-zero status 139

Related

Why does Quanteda crash in R?

I have an issue with the quanteda package in R. Whenever I try to load it, it shuts down R entirely.
Here the message:
Package version: 3.2.4
Unicode version: 14.0
ICU version: 70.1
*** caught segfault ***
address 0x245, cause 'invalid permissions'
Traceback:
1: RcppParallel::defaultNumThreads()
2: get_threads()
3: unname(min(get_threads(), na.rm = TRUE))
4: get_options_default()
5: quanteda_initialize()
6: quanteda_options(initialize = TRUE)
7: fun(libname, pkgname)
8: doTryCatch(return(expr), name, parentenv, handler)
9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch(fun(libname, pkgname), error = identity)
12: runHook(".onAttach", ns, dirname(nspath), nsname)
13: attachNamespace(ns, pos = pos, deps, exclude, include.only)
14: doTryCatch(return(expr), name, parentenv, handler)
15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
16: tryCatchList(expr, classes, parentenv, handlers)
17: 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 && !quietly) message(paste("Error:", msg), domain = NA) else stop(msg, call. = FALSE, domain = NA)})
18: library(quanteda)
OS: Mac Ventura 13.1
R version: 4.2.2 (2022-10-31 "Innocent and Trusting"
Any ideas?
The error message you provided suggests that there is a segmentation fault when trying to load the quanteda package. A segmentation fault is a type of error that occurs when a program attempts to access memory that it is not allowed to access. This can happen for a variety of reasons, but one possible cause is a conflict with other packages or libraries that are loaded in your R session.
It is recommendable to check the versions of the package dependencies of quanteda and compare them with the versions that you have installed in your system, it is possible that one of them are not compatible.
You could try uninstalling and reinstalling quanteda package along with it's dependencies as well. You can use remove.packages("quanteda") to uninstall the package and install.packages("quanteda") to install it again.
Also, you could try to start a new R session and load only the packages you need and try loading the package again.
Another solution is to check your system resources, and make sure you have enough memory available. Segmentation faults can also occur when there is not enough memory to load a package.
Lastly, you could try updating your R version and see if that resolves the issue.

R 3.6.3 dose not launch in coexistence environment with R 4.0.4

I can not launch R.app on macOS 10.15.7 (Catalina). When I launch it, the following error message was returned, and I can not do anything. But when I launch Rstudio.app, I have no problem with R 3.6.3.
Note that, before this trouble, I tried coexistantce/switching of multiple versions of R. First I uninstalled R (ver 4.0.3) through homebrew (brew uninstall --cask r). So R has been deleted completely. Then I installed R 3.6.3 and R 4.0.4 through their official installers. Also I installed Rswitch.
Rswitch switches R versions correctly now. After switching from ver 3.6.3, R 4.0.4 launches with no problem through both R.app and Rstudio.app.
Probably, it seems the "stringsAsFactors" problem relating to version 4.0. But version 4.0.4 is ok in launching in my case. This trouble occurs with R 3.6.3. Does anyone know about this kind of problem?
Thank you.
警告メッセージ (warning):
options(stringsAsFactors = TRUE) で:
'options(stringsAsFactors = TRUE)' is deprecated and will be disabled
*** caught segfault ***
address 0x2e9e8, cause 'memory not mapped'
Traceback:
1: initMethodDispatch(where)
2: fun(libname, pkgname)
3: doTryCatch(return(expr), name, parentenv, handler)
4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
5: tryCatchList(expr, classes, parentenv, handlers)
6: tryCatch(fun(libname, pkgname), error = identity)
7: runHook(".onLoad", env, package.lib, package)
8: loadNamespace(package, lib.loc)
9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: 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)})
13: library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, warn.conflicts = warn.conflicts, quietly = quietly, mask.ok = mask.ok, exclude = exclude, include.only = include.only, attach.required = attach.required)
14: doTryCatch(return(expr), name, parentenv, handler)
15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
16: tryCatchList(expr, classes, parentenv, handlers)
17: tryCatch(library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, warn.conflicts = warn.conflicts, quietly = quietly, mask.ok = mask.ok, exclude = exclude, include.only = include.only, attach.required = attach.required), error = function(e) e)
18: require(pkg, quietly = TRUE, warn.conflicts = FALSE, character.only = TRUE)
19: .OptRequireMethods()
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:

Error in loading RWeka

After installing the RWeka package with R studio,
library(RWeka)
produces a fatal error, forcing me to start a new session.
loading the package in R vanilla shows an error message like this.
> library(RWeka)
*** caught segfault ***
address 0xbf913, cause 'memory not mapped'
Traceback:
1: .jinit()
2: .jpackage(pkgname, lib.loc = libname)
3: fun(libname, pkgname)
4: doTryCatch(return(expr), name, parentenv, handler)
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: tryCatchList(expr, classes, parentenv, handlers)
7: tryCatch(fun(libname, pkgname), error = identity)
8: runHook(".onLoad", env, package.lib, package)
9: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
10: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]), 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({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps)}, 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)})
16: library(RWeka)
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:
I'm currently using Java Version 8 Update 181, R version 3.5.0, and R Studio 1.1.423 on macOD High Sierra (version 10.13.5).
Is there a way to work this through?

ggplot2 causing segfault on Mac

There are several reports for this issue all dating 2 to 3 years back:
caught segfault error in R
Problems loading packages (ie. ggplot2) on R 3.2.2 caught segfault address 0x18, cause 'memory not mapped' [duplicate]
Most of them are referring to older system versions and older ggplot2 version. I'm wondering if anybody found alternative solution to the suggested R re-installation (which apparently did not work for everyone)?
I'm on Mac 10.11.6 and when trying to install ggplot2 either from within or outside of R (R CMD INSTALL) I get segfault:
*** caught segfault ***
address 0x18, cause 'memory not mapped'
The same can be reproduced using ggplot2 versions:
1.0.0, 1.0.1, 2.0.0, 2.1.0, 2.2.0
I tested that on fresh R-3.3.2 session. The error occurs during installation, not during loading.
Traceback received:
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(package, lib.loc, keep.source, partial = TRUE)
9: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
10: suppressPackageStartupMessages(loadNamespace(package, lib.loc, keep.source, partial = TRUE))
11: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source, compress = compress)
12: makeLazyLoading(pkg_name, lib, keep.source = keep.source)
13: doTryCatch(return(expr), name, parentenv, handler)
14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
15: tryCatchList(expr, classes, parentenv, handlers)
16: 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))})
17: try({ suppressPackageStartupMessages(.getRequiredPackages(quietly = TRUE)) makeLazyLoading(pkg_name, lib, keep.source = keep.source)})
18: do_install_source(pkg_name, instdir, pkg, desc)
19: do_install(pkg)
20: tools:::.install_packages()
An irrecoverable exception occurred. R is aborting now ...
/Users/username/miniconda3/lib/R/bin/INSTALL: line 34: 2049 Done echo 'tools:::.install_packages()'
2050 Segmentation fault: 11 | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --slave --args ${args}
The reproduce, start new R session and install 'ggplot2' with:
$ R
> install.packages('ggplot2')
Session info:
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin11.4.2 (64-bit)
Running under: OS X 10.11.6 (El Capitan)
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
Any suggestions would be appreciated.

Error with ggplot2 after installing new R

I wanted to install a new version of R.
I downloaded R-3.1.0.pkg and installed it.
I mved my packages from ~/Library/R/3.0 to ~/Library/R/3.1
the new R starts, but when I try to load some packages, I get an error.
This seems to be due to ggplot2. As I can load any package that doesn't depend on ggplot2.
I just reinstalled ggplot2 using install.packges(), but still no luck. R just crashes when I try to load the library.
I performed update.packages(). Is this related to how I migrated my packages?
Also, I seem to have packages in multiple places. Although I think RStudio seems to install all of them in the ~/Library/Frameworks/R.framework/Versions/3.1/Resources/library
thanks
> library(Hmisc)
Loading required package: grid
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
*** 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(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc)
12: .getRequiredPackages2(pkgInfo, quietly = quietly)
13: library(Hmisc

Resources