I've recently been experiencing some issues with installing/loading packages. I'm not exactly sure what the cause was and what is going on. Let me provide an example.
Let's say I want to install/load the library psychmeta - I'll just write something like
install.packages("psychmeta")
library(psychmeta)
And I'm greeted with this lovely error
Error: package or namespace load failed for ‘psychmeta’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘ellipsis’
I attempt to install that package, but I get the same result, which is super strange. So I run the following
library()
And for whatever reason, ellipsis isn't there. So I run the following and get these results
This makes me think that there are two different libraries - One in which newly installed packages go and one in which library() command reads. Could someone help me resolve this discrepancy?
Thanks!
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] glue_1.4.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 assertthat_0.2.1 R6_2.4.1 magrittr_1.5 rlang_0.4.6 tools_4.0.0
[7] compiler_4.0.0 pkgconfig_2.0.3
> install.packages("ellipsis")
There is a binary version available but the source version is later:
binary source needs_compilation
ellipsis 0.3.0 0.3.1 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘ellipsis’
trying URL 'https://cran.rstudio.com/src/contrib/ellipsis_0.3.1.tar.gz'
Content type 'application/x-gzip' length 7582 bytes
==================================================
downloaded 7582 bytes
* installing *source* package ‘ellipsis’ ...
** package ‘ellipsis’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘ellipsis’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/ellipsis’
Warning in install.packages :
installation of package ‘ellipsis’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/ky/0vkyvy9d0ln1j0xgdw8whqn0br3fbv/T/RtmpK8TTmG/downloaded_packages’
If I reply "No" instead of yes - The package installs, BUT I still get this following error when attempting to load the main package...
> library(psychmeta)
Error: package or namespace load failed for ‘psychmeta’:
.onLoad failed in loadNamespace() for 'pillar', details:
call: utils::packageVersion("vctrs")
error: there is no package called ‘vctrs’
I'm not sure why. Are the dependencies not installing when I'm installing the main package?
EDIT
I went a little further down the rabbit hole. It seems like it is only happening with Dependencies that require compilation. If I select No, they install fine. HOWEVER, now I'm faced with another issue. The "Error or namespace load failed for..." issue. See below:
> library(psychmeta)
Error: package or namespace load failed for ‘psychmeta’ 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: image not found
> install.packages("gmm")
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/gmm_1.6-4.tgz'
Content type 'application/x-gzip' length 1386215 bytes (1.3 MB)
==================================================
downloaded 1.3 MB
The downloaded binary packages are in
/var/folders/ky/0vkyvy9d0ln1j0xgdw8whqn0br3fbv/T//RtmpETHtKU/downloaded_packages
> library(psychmeta)
Error: package or namespace load failed for ‘psychmeta’ 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: image not found
If you need to install the latest version from source, then you need to install Xcode in your system (not in R) and the recommended development tools for macOS systems. https://cran.r-project.org/bin/macosx/tools/