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
Related
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.
My Rstudio is 4.0.4 version, however, it showed that the package was built under R verision 3.6.3.
And I can not use this package. How to solove this problem?
library(tidymodels)
Warning message:
"package 'tidymodels' was built under R version 3.6.3"
Error: package or namespace load failed for 'tidymodels' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace 'recipes' 0.1.5 is being loaded, but >= 0.1.16 is required
Traceback:
1. library(tidymodels)
2. 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)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)
That's a warning. The actual error shows beneath:
Error: package or namespace load failed for 'tidymodels' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace 'recipes' 0.1.5 is being loaded, but >= 0.1.16 is required
And it is very clear: you need a more recent version of recipes which you can get through install.packages. It could be that a newer version of the package is not available for your R version, in which case you'll need to install RTools (assuming windows, otherwise not required) and do an installation from source.
I'm getting the below error when trying to import library & I'm using R in Jupyter Notebook.
library(ggpubr)
Warning message:
"package 'ggpubr' was built under R version 3.6.3"
Error: package or namespace load failed for 'ggpubr' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace 'rlang' 0.4.2 is already loaded, but >= 0.4.5 is required
Traceback:
1. library(ggpubr)
2. 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)
. })
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 have tried the below codes to adjust it ,But it didn't workout
remove.packages("ggpubr")
&
install.packages("ggpubr")
&
update.packages(Yes)
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.
Anytime I have tried to import a package in R, it ends up crashing. To illustrate, if I run a command such as library(broom) in my terminal, the following error is yielded:
*** 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(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
6: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]), from = package)
7: loadNamespace(package, lib.loc)
8: doTryCatch(return(expr), name, parentenv, handler)
9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: 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)})
12: library(broom)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
This error is followed by my R crashing in my terminal. Furthermore, this result replicated within RStudio, and the whole program must be reopened if I try to import packages. Interestingly, not all packages behave the same way. When I import a basic package such as library(stats) or library(base), it works fine.
I have tried to uninstall R, Rstudio, and relevant R packages from my computer and then reinstall them (as per https://support.rstudio.com/hc/en-us/community/posts/115007714568-Latest-version-of-Rstudio-rmarkdown-causing-abort-on-R-version-3-4-0-for-x86-64-apple-darwin15-6-0-64-bit-), but with no success. Is this a problem that is related to the setup of my PATH variable?
For the record, I am running R-3.4 on Mac OSX-10.12 Sierra.
UPDATE
This might not be that important, but I decided to look around and see where my packages were installed by putting them all in a dataframe in R (ip<-as.data.frame(installed.packages())), and I noticed that my packages are stored in two different file paths– either /Users/bob/Library/R/3.4/library, or /Library/Frameworks/R.framework/Versions/3.4/Resources/library. Does anybody think this discrepancy is the cause for my R crashing all the time?
After figuring out that I had installed packages downloaded to two different libraries (see Update section in question above), I decided to remove all packages that I had installed. Using this source (https://www.r-bloggers.com/how-to-remove-all-user-installed-packages-in-r/) as my guide, I carried out the following commands:
ip <- as.data.frame(installed.packages())
ip <- ip[!(ip[,"Priority"] %in% c("base", "recommended")),]
ip <- subset(ip, !grepl("MRO", ip$LibPath))
path.lib <- unique(ip$LibPath)
pkgs.to.remove <- ip[,1]
sapply(pkgs.to.remove, remove.packages, lib = path.lib)
Furthermore, I also removed any remaining packages in the folder Users/bob/Library/R/3.4/library, and then I set only one of my libraries as the default library where installed packages were downloaded to:
.libPaths("/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
And then ran .libPaths() again to make sure that this file path was the first that got printed. I then carried out install.packages("NameOfDesiredPackage") on any of the packages I wanted, and when I imported them into my console or terminal, they imported with no problem.