I'm trying to load package gmm (running "library(gmm)") and get this error message below.
It seems unfixable, as it states that my gfortran/lib/libgomp.1.dylib has the wrong architecture? I'm guessing this is related to the new Mac architecture?
library(gmm)
Loading required package: sandwich
Error: package or namespace load failed for ‘gmm’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so, 6): Library not loaded: /usr/local/gfortran/lib/libgomp.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so
Reason: no suitable image found. Did find:
**/usr/local/gfortran/lib/libgomp.1.dylib: mach-o, but wrong architecture**
/usr/local/gfortran/lib/libgomp.1.dylib: mach-o, but wrong architecture
I had the same issue on R version 4.1. Found a similar question here which points to installing (or updating) your gfortran installation here. Once I did that and restarted R, the gmm package was able to find the missing image(s) automatically when I loaded the package.
Related
I have a M1 Macbook Pro running OS Big Sur and just tried to install rjags and JAGS. I downloaded JAGS from https://sourceforge.net/projects/mcmc-jags/ without a problem, and ran install_packages("rjags"), but when I run library(rjags) I get this error:
Loading required package: coda
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Users/afredston/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.1/aarch64-apple-darwin20/rjags/4-12/e8a71b3a154c8e68c152b4cfbebfdd97/rjags/libs/rjags.so':
dlopen(/Users/afredston/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.1/aarch64-apple-darwin20/rjags/4-12/e8a71b3a154c8e68c152b4cfbebfdd97/rjags/libs/rjags.so, 10): Library not loaded: /opt/R/arm64/lib/libjags.4.dylib
Referenced from: /Users/afredston/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.1/aarch64-apple-darwin20/rjags/4-12/e8a71b3a154c8e68c152b4cfbebfdd97/rjags/libs/rjags.so
Reason: image not found
I understand this means that R cannot "find" the installation of JAGS. I am using renv for this project, but even if I deactivate it and re-run install_packages("rjags") and library(rjags) I get the error (just with different file paths):
Loading required package: coda
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rjags/libs/rjags.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rjags/libs/rjags.so, 10): Library not loaded: /opt/R/arm64/lib/libjags.4.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rjags/libs/rjags.so
Reason: image not found
I'm a stats person without much back-end computer expertise so I'd appreciate help resolving this!
See here for a similar post.
So have you installed the correct version of JAGS on your Apple computer?
Essentially, rjags is an R interface and it needs an installed JAGS (a back-end you mentioned) to function.
Follow the instructions here to install JAGS on Apple computers with M1 chips.
Also from the link above (from JAGS development team):
A readme file is provided in the disk image - please do read it.
If you find that rjags fails to load after installation of JAGS,
make sure you have installed the Mavericks or El Capitan binary of
R from CRAN. If you really need the Snow Leopard build of R (or if
you compiled R yourself) you will have to compile JAGS from source.
If you have followed the instructions above (and in the relevant
README file) and are still having problems with installation of
these binaries, please let us know via the JAGS discussion forum.
PS: I would comment if I could, but I am new here and don't have enough points to do so.
I have successfully installed arm. When trying to load the arm package, however, I get the following error message:
Error: package or namespace load failed for ‘arm’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so, 6): Symbol not found: _inflateValidate
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libz.1.dylib
in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so
I have already restarted R and updated all packages. Why is that and how can I resolve it?
Thank you!
See this question.
In summary, you might be missing the png headers for another package. Try running capabilities() to see if "png" is TRUE. If not, check which libpng*-dev packages (eg system packages) are installed and install them if they are missing (I'm not sure which version you need so might need to try several).
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!
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?
I installed the R caret package using install.packages command and did library(caret). I am recieving the following error
>library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /usr/local/lib/libtcl8.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so
Reason: image not found
Error: package or namespace load failed for ‘caret’
I searched other posts and also installed OSX tcltk package from http://cran.us.r-project.org/bin/macosx/tools/ but it still does not seem to work. I also installed tcltk2 package from R but still does not work.. Kindly help
I have met the same problem with the same error message but unfortunately, just reinstalling R1.3 didn't solve the problem for me.
To solve it, I had to install X-Quartz as explained here in the "Mac OS X Trouble-shooting" section and the problems related to tcltk.
Do this and it will resolve the problem
install.packages("quantreg")
What version of R are you using? Do you use Mavericks? You may need to update to a version which includes Mavericks updates.
http://cran.r-project.org/bin/macosx/
I had the same issue. Reinstalling Quartz solved the issue
Try this, worked for me.
install.packages("caret", dependencies = T)
Once that is done, run
install.packages("pbkrtest", dependencies = T)