Unable to load arm package in R - r

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).

Related

Cannot load R package gmm on newest macbook with Apple M1 chip

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.

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!

RStudio won't allow me to install the package 'imager'

Installed RStudio using Anaconda Navigator even though I already had RStudio and it was working fine before. The package 'imager' didn't load so I removed the application from Navigator and completely uninstall R and RStudio from my Macbook and reinstalled R and the application through Navigator, but that didn't fix things. Other packages install just fine. The following is the error message:
library(imager)
Error: package or namespace load failed for ‘imager’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/omeedkashef/Library/R/3.4/library/imager/libs/imager.so':
dlopen(/Users/omeedkashef/Library/R/3.4/library/imager/libs/imager.so, 6): Library not loaded: /opt/X11/lib/libX11.6.dylib
Referenced from: /Users/omeedkashef/Library/R/3.4/library/imager/libs/imager.so
Reason: image not found
I had this same problem. I did not have a problem installing imager from CRAN but did get an error message when trying to load the CRAN-installed package. When I tried installing from GitHub I got the more useful error message saying that X11 was not found (same as #andrii above). I solved all issues by installing X11 by downloading from this site: https://www.xquartz.org/
EDIT: I should mention that this is not a problem with RStudio per se, as the header of the question suggests, but rather just a dependency issue of one package (imager) on a not-explicitly R piece of sofware (X11).

Able to download package in R but not call it from library?

I was able to download the package "LMERConvenienceFunctions"
The downloaded binary packages are in
/var/folders/2p/3h5yk1gx4fs1gd8gtdbhdd900000gn/T//RtmpHvJyRm/downloaded_packages
However when I try to call it using:
library(LMERConvenienceFunctions)
I get the following error:
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.2/Resources/library/rgl/libs/rgl.so': dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so, 6):
Library not loaded: /opt/X11/lib/libGLU.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so
Reason: image not found
Error: package or namespace load failed for ‘LMERConvenienceFunctions’
Does anyone have any suggestions?
Thanks!
It seems like you have tried to install the "LMERConvenienceFunctions" package without also downloading it's dependencies? Running
install.packages("LMERConvenienceFunctions")
and then just using library(LMERConvenienceFunctions) worked for me in this case. If this still doesn't work, try manually installing rgl
My issue turned out to be that I didn't have XQuartz installed. It can be downloaded here: http://www.xquartz.org/
After installing it, rgl began to work, and then LMERConvenienceFunctions finally started working as well. The whole process took a few tweaks so I'm pasting the entire code below. Note that this is after installing XQuartz.
install.packages("LMERConvenienceFunctions")
install.packages("devtools") #not sure if this is necessary, but doing this before rgl was recommended on another answer on here#
library(devtools)
install.packages("rgl")
rgl.useNULL=TRUE #little thing I had to do even after installing XQuartz#
library(rgl)
library(LMERConvenienceFunctions)

Unable to load caret package in R on R 3.1.0 on OSX 10.9

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)

Resources