Why does Quanteda crash in R? - 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.

Related

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:

package 'keras' successfully installed, but can't be loaded?

I tried to installed keras on win10 + Rstudio 1.2, it was successfully installed, but can't be loaded.
Have tried to uninsatll, and re-install, but the error insists.
Please advise.
> install.packages("keras")
Installing package into ‘C:/Users/eric1/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.5:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.5/PACKAGES'
trying URL 'https://mran.microsoft.com/snapshot/2018-08-01/bin/windows/contrib/3.5/keras_2.1.6.zip'
Content type 'application/zip' length 2340096 bytes (2.2 MB)
downloaded 2.2 MB
package ‘keras’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\eric1\AppData\Local\Temp\RtmpaynDb0\downloaded_packages
> library(keras)
Error: package or namespace load failed for ‘keras’ in rbind(info, getNamespaceInfo(env, "S3methods")):
number of columns of matrices must match (see arg 2)
and the traceback is
> traceback()
6: stop(msg, call. = FALSE, domain = NA)
5: value[[3L]](cond)
4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
3: tryCatchList(expr, classes, parentenv, handlers)
2: 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)
})
1: library(keras)
With the hint from this post, I checked the reticulate, and got the same error message which i am sure it was good. So I decided the root was Python and Anaconda.
I reinstalled python and anaconda, and solved the issue.
Just make a note and hopefully it may help those who are as rooky as I am.
package or namespace load failed for ‘keras’ #268

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

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

can't load ggmap package in jupyter

I used conda install -c vfonov r-ggmap to install ggmap package. When I tried to load the package in Jupyter notebook, I got the following error:
Error: package or namespace load failed for ‘ggmap’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/anaconda3/lib/R/library/jpeg/libs/jpeg.so':
dlopen(/anaconda3/lib/R/library/jpeg/libs/jpeg.so, 6): Library not loaded: #rpath/libjpeg.9.dylib
Referenced from: /anaconda3/lib/R/library/jpeg/libs/jpeg.so
Reason: Incompatible library version: jpeg.so requires version 13.0.0 or later, but libjpeg.9.dylib provides version 12.0.0
Traceback:
1. library(ggmap)
2. 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)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)
I appreciate any help.
The solution is surprisingly easy.
conda install -c conda-forge jpeg
done.

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?

Resources