When loading a package, R is unable to load libRlapack.dylib - r

I recently updated my R (on Mac) from Version 3.0.2 to 3.1.1. I tried to load a package by using library(WRScpp)
But I got an error as shown below:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/3.0/Resources/lib/libRlapack.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so
Reason: image not found
Error: package or namespace load failed for ‘WRScpp’
It seems that R tried to load libRlapack.dylib by looking for it in the wrong directory (it looked for it in the Version 3.0 directory). I wonder what can be done to direct R to search the correct directory?

Related

Issue with the installation of terra package in R

I am using RRstudio 4.2.1 and I am trying to install the terra package.
Unfortunately, I get following error that I don't understand
Error: package or namespace load failed for ‘terra’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object 'my_path_here/R/x86_64-pc-linux-gnu-library/4.2/terra/libs/terra.so':
libproj.so.25: cannot open shared object file: No such file or directory
I haven't came across this error again, so I would like some help!
P.S when I am trying installing it from the terminal, I get the following in the middle of installation :./proj_conf_test: error while loading shared libraries: libproj.so.25: cannot open shared object file: No such file or directory
Thanks!

Unable to load R package gsl: libgsl.so.25: cannot open shared object file: No such file or directory

My R version is 4.1.2. It seems that I successfully install gsl package, but when I run library(gsl), I get following error:
Error: package or namespace load failed for ‘energy’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/public/home/username/localR/lib64/R/library/gsl/libs/gsl.so':
libgsl.so.25: cannot open shared object file: No such file or directory
Only this package has the error above. Meanwhile, when I try to use the packages related to it(e.x. energy), R will occur the same error. However, other packages are not affected.
Thanks.

I am facing issues while trying to install emojifont package on Mac book

I am installing emojifont package. The package installs properly however when I try to call it through the library function I get the following error
Error: package or namespace load failed for ‘emojifont’:
.onLoad failed in loadNamespace() for 'sysfonts', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sysfonts/libs/sysfonts.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sysfonts/libs/sysfonts.so, 6): Library not loaded: /opt/X11/lib/libfreetype.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/sysfonts/libs/sysfonts.so
Reason: image not found
What ended up working for me was installing XQuartz. I had this problem with both emojifont and sysfonts until I installed XQuartz and then both loaded without problems. I can't tell you much about what XQuartz is doing but it seems to be needed for the compatibility between MacOS and these packages.
Other people with this problem seemed to be having issues with their sysfonts install (like it needed to be updated, etc.) but that didn't work for me, instead I got an error when using trying to load both the sysfonts and the emojifont package. If you look at this line in the error "Library not loaded: /opt/X11/lib/libfreetype.6.dylib", that seems to be missing in the error message of people with only the sysfonts problem.
Hope this saves someone the 2 hours I just spent searching!

Trouble adding package to library() after installing package

I keep getting the same error, for both first for XLConnect, (which I thought was a java problem) and now rJava (which is also not working). This is the error message I get when I library(rJava):
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
'/Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so':
dlopen(/Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so, 6):
Library not loaded: #rpath/libjvm.dylib Referenced from:
/Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so Reason:
image not found
I am new to R, and just need to figure out how to get these packages working, thanks!
Try (check your java version and change accordingly):
Sys.setenv(JAVA_HOME = "C:/Program Files/Java/jre-9.0.1")
And then load library.
Install package xlsx if you are trying to access Excel file by entering install.packages("xlsx", dependencies = T) in your console.
Another R package for working with excel data which does not require rJava is openxlsx. I've found it works faster than java-based packages, which is a nice bonus.

R libraries won't load after upgrading

I upgraded my R version today from 3.1 to 3.2. In doing so, I kept a copy of my original libraries in a separate folder. After installing version 3.2, I pasted the libraries in the libraries folder of R 3.2.
After doing so, I upgraded Bioconductor, and updated all its packages.
However, when I try to load some (not all) bioconductor packages right now in R, I get the following error:
library(ballgown)
Error : .onLoad failed in loadNamespace() for 'XML', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Users/user/Library/R/3.2/library/XML/libs/XML.so':
dlopen(/Users/user/Library/R/3.2/library/XML/libs/XML.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/3.1/Resources/lib/libR.dylib
Referenced from: /Users/user/Library/R/3.2/library/XML/libs/XML.so
Reason: image not found
Error: package or namespace load failed for ‘ballgown’
It looks like he's still looking for something in the older 3.1 version, but I deleted that folder.
Here is my library path in R:
.libPaths()
[1] "/Users/user/Library/R/3.2/library"
[2] "/Library/Frameworks/R.framework/Versions/3.2/Resources/library"
Remarkably, when loading the same packages in RStudio, the error does not pop up. How can I still fix this?
Thanks.

Resources