Failed to install packages in R - r

I just started R. I am on a M1 BigSur Mac.
I have tried several packages, but I could not install anyone of them.
for example, swirl
> install.packages("swirl")
trying URL 'https://cran.rstudio.com/src/contrib/swirl_2.4.5.tar.gz'
Content type 'application/x-gzip' length 108847 bytes (106 KB)
==================================================
downloaded 106 KB
* installing *source* package ‘swirl’ ...
** package ‘swirl’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/opt/homebrew/Cellar/r/4.1.0/lib/R/library/stringi/libs/stringi.so':
dlopen(/opt/homebrew/Cellar/r/4.1.0/lib/R/library/stringi/libs/stringi.so, 6): no suitable image found. Did find:
/opt/homebrew/Cellar/r/4.1.0/lib/R/library/stringi/libs/stringi.so: mach-o, but wrong architecture
/opt/homebrew/Cellar/r/4.1.0/lib/R/library/stringi/libs/stringi.so: mach-o, but wrong architecture
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘swirl’
* removing ‘/opt/homebrew/Cellar/r/4.1.0/lib/R/library/swirl’
Warning in install.packages :
installation of package ‘swirl’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/t6/qy2rcbdx0g9_fv98q1g48v_h0000gn/T/RtmpDAcI28/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
tidyverse it has been repeating the following output but it does not complete a proper installation.
* installing *source* package ‘cpp11’ ...
** package ‘cpp11’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (cpp11)
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.1.0/lib/R/include" -DNDEBUG -I../inst/include/ -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c api.cpp -o api.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.1.0/lib/R/include" -DNDEBUG -I../inst/include/ -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c attributes.cpp -o attributes.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.1.0/lib/R/include" -DNDEBUG -I../inst/include/ -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c barrier.cpp -o barrier.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.1.0/lib/R/include" -DNDEBUG -I../inst/include/ -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c date.cpp -o date.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.1.0/lib/R/include" -DNDEBUG -I../inst/include/ -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c module.cpp -o module.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.1.0/lib/R/include" -DNDEBUG -I../inst/include/ -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c rcpp_init.cpp -o rcpp_init.o
clang++ -std=gnu++14 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/homebrew/Cellar/r/4.1.0/lib/R/lib -L/opt/homebrew/opt/gettext/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/xz/lib -L/opt/homebrew/lib -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o -L/opt/homebrew/Cellar/r/4.1.0/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
I tried install.package('swirl', type='mac.binary').
It forces a successful installation but it gives the following error when I call library("swirl"):
Error: package or namespace load failed for ‘swirl’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/opt/homebrew/Cellar/r/4.1.0/lib/R/library/stringi/libs/stringi.so':
dlopen(/opt/homebrew/Cellar/r/4.1.0/lib/R/library/stringi/libs/stringi.so, 6): no suitable image found. Did find:
/opt/homebrew/Cellar/r/4.1.0/lib/R/library/stringi/libs/stringi.so: mach-o, but wrong architecture
/opt/homebrew/Cellar/r/4.1.0/lib/R/library/stringi/libs/stringi.so: mach-o, but wrong architecture

Related

I cannot install the 'coin' package on R or RStudio on Mac OS Monterey Version 12.6 for `wilcox_effsize()`

I cannot tried installing the coin package so I can use the wilcox_effsize() for my dataset.
The problem -
> wilcox_effsize(data = runDataValidMeansA, formula = runtime ~ A.mode, p.adjust.method = "BH")
Error in required_package("coin") :
coin package needed to be installed before using this function. Type this in R: install.packages('coin')
What I tried - using `install.packages('coin')
> install.packages('coin')
Installing package into ‘/opt/homebrew/lib/R/4.2/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/coin_1.4-2.tar.gz'
Content type 'application/x-gzip' length 1225311 bytes (1.2 MB)
==================================================
downloaded 1.2 MB
* installing *source* package ‘coin’ ...
** package ‘coin’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/opt/homebrew/Cellar/r/4.2.1_2/lib/R/include" -DNDEBUG -I'/opt/homebrew/lib/R/4.2/site-library/libcoin/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -Wno-implicit-function-declaration -c Helpers.c -o Helpers.o
clang -I"/opt/homebrew/Cellar/r/4.2.1_2/lib/R/include" -DNDEBUG -I'/opt/homebrew/lib/R/4.2/site-library/libcoin/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -Wno-implicit-function-declaration -c StreitbergRoehmel.c -o StreitbergRoehmel.o
clang -I"/opt/homebrew/Cellar/r/4.2.1_2/lib/R/include" -DNDEBUG -I'/opt/homebrew/lib/R/4.2/site-library/libcoin/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -Wno-implicit-function-declaration -c coin-init.c -o coin-init.o
clang -I"/opt/homebrew/Cellar/r/4.2.1_2/lib/R/include" -DNDEBUG -I'/opt/homebrew/lib/R/4.2/site-library/libcoin/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -Wno-implicit-function-declaration -c vandeWiel.c -o vandeWiel.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/homebrew/Cellar/r/4.2.1_2/lib/R/lib -L/opt/homebrew/opt/gettext/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/xz/lib -L/opt/homebrew/lib -o coin.so Helpers.o StreitbergRoehmel.o coin-init.o vandeWiel.o -L/opt/homebrew/opt/openblas/lib -lopenblas -L/opt/homebrew/opt/gcc/lib/gcc/current/gcc/aarch64-apple-darwin21/12 -L/opt/homebrew/opt/gcc/lib/gcc/current/gcc -L/opt/homebrew/opt/gcc/lib/gcc/current -lgfortran -lemutls_w -lquadmath -L/opt/homebrew/Cellar/r/4.2.1_2/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: warning: -undefined dynamic_lookup may not work with chained fixups
ld: warning: could not create compact unwind for ___emutls_get_address: registers 23 and 24 not saved contiguously in frame
installing to /opt/homebrew/lib/R/4.2/site-library/00LOCK-coin/00new/coin/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/opt/homebrew/lib/R/4.2/site-library/mvtnorm/libs/mvtnorm.so':
dlopen(/opt/homebrew/lib/R/4.2/site-library/mvtnorm/libs/mvtnorm.so, 0x0006): Library not loaded: '/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib'
Referenced from: '/opt/homebrew/lib/R/4.2/site-library/mvtnorm/libs/mvtnorm.so'
Reason: tried: '/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/opt/homebrew/Cellar/r/4.2.1_2/lib/R/lib/libgfortran.5.dylib' (no such file)
Calls: <Anonymous> ... asNamespace -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘coin’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/coin’
Warning in install.packages :
installation of package ‘coin’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/n6/dd96yfrs3wd9hnznyjqr4f280000gp/T/RtmpFEtn97/downloaded_packages’
I also tried installing using the source as was mentioned here
And I still get the same error.
> install.packages("libs/coin_1.4-2.tar.gz", repos = NULL, type = "source")
Installing package into ‘/opt/homebrew/lib/R/4.2/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘coin’ ...
** package ‘coin’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/opt/homebrew/Cellar/r/4.2.1_4/lib/R/include" -DNDEBUG -I'/opt/homebrew/lib/R/4.2/site-library/libcoin/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -Wno-implicit-function-declaration -c Helpers.c -o Helpers.o
clang -I"/opt/homebrew/Cellar/r/4.2.1_4/lib/R/include" -DNDEBUG -I'/opt/homebrew/lib/R/4.2/site-library/libcoin/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -Wno-implicit-function-declaration -c StreitbergRoehmel.c -o StreitbergRoehmel.o
clang -I"/opt/homebrew/Cellar/r/4.2.1_4/lib/R/include" -DNDEBUG -I'/opt/homebrew/lib/R/4.2/site-library/libcoin/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -Wno-implicit-function-declaration -c coin-init.c -o coin-init.o
clang -I"/opt/homebrew/Cellar/r/4.2.1_4/lib/R/include" -DNDEBUG -I'/opt/homebrew/lib/R/4.2/site-library/libcoin/include' -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -Wno-implicit-function-declaration -c vandeWiel.c -o vandeWiel.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/homebrew/Cellar/r/4.2.1_4/lib/R/lib -L/opt/homebrew/opt/gettext/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/xz/lib -L/opt/homebrew/lib -o coin.so Helpers.o StreitbergRoehmel.o coin-init.o vandeWiel.o -L/opt/homebrew/opt/openblas/lib -lopenblas -L/opt/homebrew/opt/gcc/lib/gcc/current/gcc/aarch64-apple-darwin21/12 -L/opt/homebrew/opt/gcc/lib/gcc/current/gcc -L/opt/homebrew/opt/gcc/lib/gcc/current -lgfortran -lemutls_w -lquadmath -L/opt/homebrew/Cellar/r/4.2.1_4/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: warning: -undefined dynamic_lookup may not work with chained fixups
ld: warning: could not create compact unwind for ___emutls_get_address: registers 23 and 24 not saved contiguously in frame
installing to /opt/homebrew/lib/R/4.2/site-library/00LOCK-coin/00new/coin/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/opt/homebrew/lib/R/4.2/site-library/mvtnorm/libs/mvtnorm.so':
dlopen(/opt/homebrew/lib/R/4.2/site-library/mvtnorm/libs/mvtnorm.so, 0x0006): Library not loaded: '/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib'
Referenced from: '/opt/homebrew/lib/R/4.2/site-library/mvtnorm/libs/mvtnorm.so'
Reason: tried: '/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/opt/homebrew/Cellar/r/4.2.1_4/lib/R/lib/libgfortran.5.dylib' (no such file)
Calls: <Anonymous> ... asNamespace -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘coin’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/coin’
Warning in install.packages :
installation of package ‘libs/coin_1.4-2.tar.gz’ had non-zero exit status
I also tried uninstalling and reinstalling R but I still get the same error. Any workarounds to get wilcox_effsize to work?
My version of R is - R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"

MacOS - Install package "png" into R fails - Library not loaded: #rpath/libz.1.dylib

I am trying desperately to install package png into R on MacOS Big Sur 11.3 .
Unfortunately, I have issue with libz.1.dylib : it seems that installation doesn't find it.
However, I have copied from /opt/local/lib/libz.1.dylib to /usr/lib and /usr/local/lib directories with DYLD_LIBRARY_PATH set correctly to them.
Here the output of installation :
> install.packages('png')
Installing package into ‘/usr/local/lib/R/4.1/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.irsn.fr/src/contrib/png_0.1-7.tar.gz'
Content type 'application/x-gzip' length 24990 bytes (24 KB)
==================================================
downloaded 24 KB
* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc-9 -I"/usr/local/Cellar/r/4.1.1/lib/R/include" -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include `libpng-config --cflags` -fPIC -mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib -c read.c -o read.o
...
gcc-9 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/4.1.1/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/xz/lib -L/usr/local/lib -o png.so read.o write.o -L/opt/intel/oneapi/intelpython/latest/lib -lpng16 -lz -L/usr/local/Cellar/r/4.1.1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
installing to /usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘png’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so':
dlopen(/usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so, 6): Library not loaded: #rpath/libz.1.dylib
Referenced from: /usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/4.1/site-library/png’
The downloaded source packages are in
‘/private/tmp/Rtmp9boK6h/downloaded_packages’
Warning message:
In install.packages("png") :
installation of package ‘png’ had non-zero exit status
My file ~/.R/Makevars is :
VER=-9
CC=gcc$(VER)
CXX=g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib
FLIBS=-L/usr/local/Cellar/gcc#9/9.4.0/lib/gcc/9 -L/opt/local/lib
PKG_LIBS=$(PNG_LIBS) `libpng-config --static --ldflags`
PKG_CFLAGS=$(PNG_CFLAGS) `libpng-config --cflags`
How could I circumvent this issue ?

Cannot properly install/load Rcpp

Trying desperately to load and work with Rcpp (well really I am trying to work in the package Seurat which needs Rcpp)
> library(Seurat)
Error: package or namespace load failed for ‘Seurat’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘Rcpp’
In addition: Warning message:
package ‘Seurat’ was built under R version 4.0.2
> install.packages("Rcpp")
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/Rcpp_1.0.5.tgz'
Content type 'application/x-gzip' length 3215939 bytes (3.1 MB)
==================================================
downloaded 3.1 MB
The downloaded binary packages are in
/var/folders/hl/247qzpv55z99f6kgddn95kk80000gn/T//RtmpX3Ovqt/downloaded_packages
> library(Rcpp)
Error: package or namespace load failed for ‘Rcpp’ 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 ‘Rcpp’ was built under R version 4.0.2
I have tried the following
restarting, reinstalling -> same errors
Making sure Xcode is installed (downloaded from app store)
Installed Command Line Tools from terminal with xcode-select --install
Installing from source
> install.packages("Rcpp", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.5.tar.gz'
Content type 'application/x-gzip' length 2950521 bytes (2.8 MB)
==================================================
downloaded 2.8 MB
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -Wall -g -O2 -c api.cpp -o api.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -Wall -g -O2 -c attributes.cpp -o attributes.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -Wall -g -O2 -c barrier.cpp -o barrier.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -Wall -g -O2 -c date.cpp -o date.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -Wall -g -O2 -c module.cpp -o module.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -Wall -g -O2 -c rcpp_init.cpp -o rcpp_init.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-Rcpp/00new/Rcpp/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Rcpp)
The downloaded source packages are in
‘/private/var/folders/hl/247qzpv55z99f6kgddn95kk80000gn/T/RtmpX3Ovqt/downloaded_packages’
> library(Rcpp)
Error: package or namespace load failed for ‘Rcpp’ in get(Info[i, 1], envir = env):
lazy-load database '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/R/Rcpp.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
Can someone please advise?
Thanks!

Unable to install R packages because of problems with Rcpp

To reproduce:
Follow the instructions in the README of https://github.com/yencarnacion/GCP-jupyter-notebook
open an R jupyter notebook and execute:
system("mkdir -p ~/anaconda3/lib/R/library", intern=TRUE)
system("echo R_LIBS=~/anaconda3/lib/R/library > ~/.Renviron", intern=TRUE)
* Then do a Kernel>Restart and in the first cell of your notebook put:
.libPaths("~/anaconda3/lib/R/library")
as user ubuntu do:
wget https://cran.rstudio.com/src/contrib/Rcpp_0.12.10.tar.gz
as user ubuntu do:
/usr/lib/anaconda/lib/R/bin/R CMD INSTALL --library=~/anaconda3/lib/R/library Rcpp_0.12.10.tar.gz
This is the output I get from /usr/lib/anaconda/lib/R/bin/R CMD INSTALL --library=~/anaconda3/lib/R/library Rcpp_0.12.10.tar.gz:
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include -fpic -I/usr/lib/anaconda/include -c Date.cpp -o Date.o
g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include -fpic -I/usr/lib/anaconda/include -c Module.cpp -o Module.o
g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include -fpic -I/usr/lib/anaconda/include -c Rcpp_init.cpp -o Rcpp_init.o
g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include -fpic -I/usr/lib/anaconda/include -c api.cpp -o api.o
g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include -fpic -I/usr/lib/anaconda/include -c attributes.cpp -o attributes.o
g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include -fpic -I/usr/lib/anaconda/include -c barrier.cpp -o barrier.o
g++ -shared -L/usr/lib/anaconda/lib/R/lib -L/usr/lib/anaconda/lib -lgfortran -o Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o -L/usr/lib/anaconda/lib/R/lib -lR
installing to /home/ubuntu/anaconda3/lib/R/library/Rcpp/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/ubuntu/anaconda3/lib/R/library/Rcpp/libs/Rcpp.so':
/home/ubuntu/anaconda3/lib/R/library/Rcpp/libs/Rcpp.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/ubuntu/anaconda3/lib/R/library/Rcpp’
Because of the Rcpp problem, I am unable to devtools::install_github('rstudio/leaflet') among other things.
Note: This question may be related to Rcpp package in R not install ubuntu 14.04
You can install Rcpp through conda:
conda install r-rcpp
Fyi, you can create a Jupyter Notebook for R on GCP in seconds by using GCP's new AI Platform Notebooks.
In the GCP console go to AI Notebooks -> New Instance -> Select R. You should be able to install any R packages that you need

Install png on yosemite & RRO

I am trying to install the package png on a macbookpro 2014 & yosemite.
I am using RRO (but I believe I would have a similar issue with R).
This is what I can see on the RRO console:
* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include `libpng-config --cflags` -fPIC -Wall -mtune=core2 -g -O2 -c read.c -o read.o
/bin/sh: libpng-config: command not found
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include `libpng-config --cflags` -fPIC -Wall -mtune=core2 -g -O2 -c write.c -o write.o
/bin/sh: libpng-config: command not found
/bin/sh: libpng-config: command not found
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o png.so read.o write.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
/bin/sh: libpng-config: command not found
installing to /Library/Frameworks/R.framework/Versions/3.1/Resources/library/png/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/png/libs/png.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/png/libs/png.so, 6): Symbol not found: _png_create_info_struct
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/png/libs/png.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/3.1/Resources/library/png/libs/png.so
Error: loading failed
Execution halted
ERROR: loading failed
On the other hand I have installed (using homebrew) libpng and I can type libpng-config on the terminal having a response
Usage: /usr/local/bin/libpng-config [OPTION] ...
I am running out of options...

Resources