Caret package is not loading - r

I'm having problem with Caret package,
Please see the error below,
library(caret)
Error: package or namespace load failed for ‘caret’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: _EXTPTR_PTR
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so
Expected in: /Library/Frameworks/R.framework/Resources/lib/libR.dylib
in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so
In addition: Warning message:
package ‘caret’ was built under R version 4.0.2
I am using macOS Catalina.
Thanks in advance,
Daniel

I had a similar issue when moving from 4.0 to 4.1 and reinstalling ggplot2
Basically when loading vctrs it was using the libR.dylib from the R.Framework 4.0 not the 4.1 (and I removed the 4.0)
>library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in
dyn.load(file, DLLpath = DLLpath, ...): unable to load shared
object '/Users/xxxx/Library/R/4.1/library/vctrs/libs/vctrs.so':
dlopen(/Users/xxxx/Library/R/4.1/library/vctrs/libs/vctrs.so, 6):
Library not loaded:
/Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib
Referenced from: /Users/lgzdl/Library/R/4.1/library/vctrs/libs/vctrs.so
Reason: image not found
My temporary solution has been to duplicate the 4.1 and renamed it 4.0. At, least for now > library(vctrs) is not throwing an error!
There must be a lingering reference to the R.Framework 4.0? somewhere?

I resolve this problem with latest release R-4.0.2.pkg in www.r-project.org -> Download -> CRAN and select your country.

Related

Problems to load tidyverse

I installed tidyverse in R Studio, but I'm having a problem running it.
I ran library("tidyverse") but I keep getting an error.
error: package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: _EXTPTR_PTR
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so
Expected in: /Library/Frameworks/R.framework/Resources/lib/libR.dylib
in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/libs/Rcpp.so
In addition: Warning message:
package ‘tidyverse’ was built under R version 4.0.2
I also tried uninstalling and reinstalling but that didn't seem to work.
We answered that a few times. It is an unfortunate error in R 4.0.0 and R 4.0.1 which changed a minor detail about EXTPTR_PTR.
Upgrade to R 4.0.2 and the issue will go away.
The error is also encountered in installing Rcpp package and it is seems can be solved by upgrading the R version to 4.02.

error message trying to install homals package in R

I'm trying to install the Homals package - library(homals), but keep getting this error message:
library(homals)
Error : .onLoad failed in loadNamespace() for 'rgl', details: call:
dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared
object
'/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so,
6): Library not loaded: /opt/X11/lib/libGLU.1.dylib Referenced from:
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so
Reason: image not found Error: package or namespace load failed for
‘homals’
I have a couple of my colleagues to run the same code, the same thing happens. I have re-install R studio to the newest version.
install.packages("rgl")
install.packages("homals")
library(homals)
Any solutions for this? thank you.
I was able to successfully install on both Windows and Mac. I believe the root cause here is that you have R version 3.3 installed when you require at least v3.5.3 as per below:
library(homals)
Warning message:
package ‘homals’ was built under R version 3.5.3

_OCIArrayDescriptorAlloc not found during ROracle installation

I am trying to install the ROracle library but I get this error:
Error: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/ROracle/libs/ROracle.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/ROracle/libs/ROracle.so, 6): Symbol not found: _OCIArrayDescriptorAlloc
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/ROracle/libs/ROracle.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/3.5/Resources/library/ROracle/libs/ROracle.so
I tried to follow different approach like this but nevertheless I can't fix it.
I am using macOS Sierra 10.12.6 and R version 3.5.1.

Conflicts between MacOS High Sierra and R packages

I am running MacOS 10.13 (High Sierra) and recently updated to R version 3.4.3 and R studio version 1.1.419. For some reason the rJava package is not working...tried several fixes from here on stackoverflow and nothing works. Also, the digest package will not load so I can no longer use ggplot2. Any suggestions?
Error for Java:
> library("rJava", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
Error for digest package:
> library("rJava", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
New Mac OSX releases have a documented problem of messing up the Java path in R/RStudio (see here). It looks as though that this is what you're encountering here.
If you check out the question I've linked above, hopefully you can find a solution that works to reset your path; both of the commands below worked for me.
dyn.load('/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/lib/server/libjvm.dylib')
or
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
I don't know about the problem with rJava, but digest was just updated so if you try to install the binary it may not compiled and built yet. If that ever happens (it's somewhat of a race condition/lag), you can try to reinstall form source:
install.packages("digest", type = "source")

namespace load failed for ‘sf’ (R package) , unable to load shared object

I am attempting to install R 'sf' on a Centos machine. After extended problems with gdal (now fixed by building from source), I now get:
Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/my_user_name/R/x86_64-redhat-linux-gnu-
library/3.4/sf/libs/sf.so':
/home/my_user_name/R/x86_64-redhat-linux-gnu-library/3.4/sf/libs/sf.so:
undefined symbol: ZN15OGRMultiSurface18CastToMultiPolygonEPS
How can I resolve this error?
So, this problem was apparently caused by my manual install of gdal not correctly linking to geos.
So I just reinstalled gdal following these instructions (https://trac.osgeo.org/gdal/wiki/BuildingOnUnix) with --with-geos=yes as a flag to ./configure.
This solved the problem.

Resources