R Packages downloaded in private since new R update on macOS - r

Since the new update of R on my Mac (version 11.2.2), I can't download any package.
Well, I can, but it is placed inside a "private" folder, while it's specified that it should be in my Library.
For instance, when I want to download 'mapsf' it gives me this error:
Installing package into ‘/Users/elifka/Library/R/3.6/library’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘mapsf’
Do you want to attempt to install these from sources? (Yes/no/cancel) y
installing the source package ‘mapsf’
trying URL 'http://cran.rstudio.com/src/contrib/mapsf_0.1.1.tar.gz'
Content type 'application/x-gzip' length 2904481 bytes (2.8 MB)
==================================================
downloaded 2.8 MB
* installing *source* package ‘mapsf’ ...
** package ‘mapsf’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c RcppExports.cpp -o RcppExports.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c init.c -o init.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c layout.cpp -o layout.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -Wl,-rpath,/Library/Frameworks/R.framework/Resources/lib /Library/Frameworks/R.framework/Resources/lib/libc++abi.1.dylib -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o mapsf.so RcppExports.o init.o layout.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: framework not found CoreFoundation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mapsf.so] Error 1
ERROR: compilation failed for package ‘mapsf’
* removing ‘/Users/elifka/Library/R/3.6/library/mapsf’
Warning in install.packages :
installation of package ‘mapsf’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/h3/vt0n6y2534b35ss3dzf_037m0000gn/T/RtmpV1gjTe/downloaded_packages’
I tried to put type='binary'in the install.packages() as it was suggested in another post, butit did not do the work.
I also tried to put 'no' for compilation and it did not work neither.
Cheers,

Ok so I fixed it by deleting R Studio and R and reinstalling both.

Deleting R Studio and R and reinstalling both worked form me too

Related

irlba not installing on Mac OS

I cannot seem to get the irlba R package to install on my mac system.
After running install.packages("irlba", force = TRUE, type = "source"), I get the following error
Content type 'application/x-gzip' length 233555 bytes (228 KB)
==================================================
downloaded 228 KB
* installing *source* package ‘irlba’ ...
** package ‘irlba’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Matrix/include' -I/usr/local/include -fPIC -Wall -g -O2 -c irlb.c -o irlb.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Matrix/include' -I/usr/local/include -fPIC -Wall -g -O2 -c utility.c -o utility.o
clang -mmacosx-version-min=10.13 -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 irlba.so irlb.o utility.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [irlba.so] Error 1
ERROR: compilation failed for package ‘irlba’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/irlba’
Warning in install.packages :
installation of package ‘irlba’ had non-zero exit status
What does the ...had a non-zero exit status warning tag mean? and how can I resolve that?
I would appreciate any help with this!
You are missing a FORTRAN compiler on macOS which is common and well-known. CRAN maintains a dedicated section on how to work around that, see and carefully read:
https://mac.r-project.org/tools/

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!

tm package installation errors in R version 3.6.1 (2019-07-05) -- "Action of the Toes"

I am trying to work with tm package in R on my Macbook Pro (late 2011) running under macOS High Sierra Version 10.13.6. The tm package has been installed but when I load it, I receive the following error message
Error: package or namespace load failed for ‘tm’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘slam’
Then I tried to install slam and got this:
There is a binary version available but the source
version is later:
binary source needs_compilation
slam 0.1-45 0.1-46 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) y
installing the source package ‘slam’
trying URL 'https://cran.rstudio.com/src/contrib/slam_0.1-46.tar.gz'
Content type 'application/x-gzip' length 53515 bytes (52 KB)
==================================================
downloaded 52 KB
* installing *source* package ‘slam’ ...
** package ‘slam’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c apply.c -o apply.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c dll.c -o dll.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c grouped.c -o grouped.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c sparse.c -o sparse.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c util.c -o util.o
clang -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 slam.so apply.o dll.o grouped.o sparse.o util.o -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [slam.so] Error 1
ERROR: compilation failed for package ‘slam’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/slam’
Warning in install.packages :
installation of package ‘slam’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/zq/lzsw_rp15sj3wtfvb3r0kksc0000gn/T/RtmpX95gez/downloaded_packages’```
Can anyone please help me fix this?
Thanks!
I have come across exactly the same issue today. I'm running R 3.6.1 (as you are) on a Mac Book Pro using macOS Mojave (10.14.6), and I have the same error messages.
I tried some of the answers from here:
dependency ‘slam’ is not available when installing TM package
by trying:
install.packages("NLP", dependencies = TRUE)
install.packages("tm", dependencies = TRUE)
.....but no joy.
So I went to here:
https://cran.r-project.org/web/packages/slam/index.html
And downloaded slam_0.1-45.tgz to my Downloads folder
And then installed it directly from there, using:
install.packages("~/Downloads/slam_0.1-45.tgz", repos = NULL, type = .Platform$pkgType)
And it seems to now install the tm package fine.

R Rcpp install error in R 3.1.0

I want to install Rcpp using install.packages("Rcpp"), but it failed.
The error message:
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c Date.cpp -o Date.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c Module.cpp -o Module.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c Rcpp_init.cpp -o Rcpp_init.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c api.cpp -o api.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c attributes.cpp -o attributes.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c barrier.cpp -o barrier.o
g++ -shared -L/usr/local/lib64 -o Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o
installing to /home/sethbrin/R/x86_64-redhat-linux-gnu-library/3.1/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/sethbrin/R/x86_64-redhat-linux-gnu-library/3.1/Rcpp/libs/Rcpp.so':
/home/sethbrin/R/x86_64-redhat-linux-gnu-library/3.1/Rcpp/libs/Rcpp.so: undefined symbol: _ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffExSt12_Ios_SeekdirSt13_Ios_Openmode
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/sethbrin/R/x86_64-redhat-linux-gnu-library/3.1/Rcpp’
The downloaded source packages are in
‘/tmp/Rtmp6PKB8N/downloaded_packages’
Warning message:
In install.packages("Rcpp") :
installation of package ‘Rcpp’ had non-zero exit status
Then I use
c++fit _ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffExSt12_Ios_SeekdirSt13_Ios_Openmode
std::basic_streambuf<char, std::char_traits<char> >::seekoff(long long, std::_Ios_Seekdir, std::_Ios_Openmode)
I have searched for some solutions for that. It seems that it is because of the gcc version. But I don't know how to change the gcc version that R uses to compile Rcpp package.
CRAN tests Rcpp just like any other of the (by now) 6700+ package.
You can see the aggregate test report and the test setups includes two Fedora-based machines:
one fedora setup using clang and
one fedora setup using g++.
As such your problems are possibly local, or simply due to using an older setup. In which case the Archive section gives you access to an older version.
I've encountered a similar problem.
And after some searches, here are the solutions to alter the compiler:
1. If you have the root privilege:
I found that the Makeconf file in R directory actually sets all the information that is needed for compilation.
To find the path to it, echo which R in the command line.
e.g. I got like:
/data/apps/R/3.1.2/bin/R
And then the file is in:
/data/apps/R/3.1.2/lib64/R/etc/Makeconf
then sudo edit the file on line CC = XXX and maybe more relative lines.
Problem solved!
2. If you only have local user privilege.
Add your own configurations to ~/.R/Makevars
However, #Dirk is probably right.
For me, I finally solved my problem by adding -Doff_t=__off_t to CFLAGS (My problem was error: unknown type name 'off_t'). And I got the halted error when I manually altered parts of the compilers...

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