irlba not installing on Mac OS - r

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/

Related

R Packages downloaded in private since new R update on macOS

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

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.

Installing R package BASiCS on macOS High Sierra

I'm trying to install BASiCS in R 3.4.2 on macOS High Sierra. I've installed R via homebrew. I've also installed gfortran as part of gcc via brew install gcc.
Still, I get the error below. Does anyone have a clue how to resolve this?
Thanks,
ERROR MESSAGE IN R
Downloading GitHub repo catavallejos/BASiCS#master
from URL https://api.github.com/repos/catavallejos/BASiCS/zipball/master
Installing BASiCS
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ \
--no-save --no-restore --quiet CMD INSTALL \
'/private/var/folders/xk/dfj20kgd56xg8796xh874tjr0000gn/T/RtmpW243tu/devtools3375bbc3c81/catavallejos-BASiCS-407caff' \
--library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library' \
--install-tests
* installing *source* package ‘BASiCS’ ...
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include" -I/usr/local/include -fPIC -Wall -g -O2 -c BASiCS_CPPcode.cpp -o BASiCS_CPPcode.o
In file included from BASiCS_CPPcode.cpp:12:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include/RcppCommon.h:122:
/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include/Rcpp/exceptions.h:103:53: warning: all paths through this function will call itself
[-Winfinite-recursion]
inline void warning(const std::string& message) { // #nocov start
^
1 warning generated.
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.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 BASiCS.so BASiCS_CPPcode.o RcppExports.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-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: *** [BASiCS.so] Error 1
ERROR: compilation failed for package ‘BASiCS’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/BASiCS’
Installation failed: Command failed (1)
It seems you need to install gfortran from CRAN, rather than via homebrew.
I had the same problem and solved it with this github recommendation.

How install package from source in Mac OS when fortran is needed in R?

I am having problems installing the Package packfor form source in Mac OS X Yosemite in the R software. I know that the package depends on fortran compiler, so I installed the gfortran available in CRAN but it does not affect anything. Bellow I am reproducing the error log.
please if anyone has any advice on this would be much appreciated.
Thanks in advance
install.packages("~/Downloads/packfor_0.0-8.tar", repos =
NULL,type="source")
installing source package ‘packfor’ ...
** libs clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c forward.c -o forward.o forward.c:411:3: warning: implicit declaration of function 'dgesvd_' is invalid in C99 [-Wimplicit-function-declaration]
F77_CALL(dgesvd)(&jobu, &jobvt,&size, &size,A, &size,
D,U,&size,V,&size,&work1, &lwork,&error); ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22:
note: expanded from macro 'F77_CALL'
define F77_CALL(x) x ## _
^ :8:1: note: expanded from here dgesvd_ ^ forward.c:421:43: warning: data argument not used by
format string [-Wformat-extra-args]
fprintf(stderr, "error in dinvG: ", error);
~~~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Resources/include/R_ext/Error.h:51:15:
note: expanded from macro 'error'
define error Rf_error
^ 2 warnings generated. 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 packfor.so forward.o -L/Library/Frameworks/R.framework/Resources/lib
-lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation Warning message: In install.packages("~/Downloads/packfor_0.0-8.tar", repos = NULL, :
installation of package ‘/Users/rafael/Downloads/packfor_0.0-8.tar’
had non-zero exit status ld: warning: directory not found for option
'-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2' ld: library not
found for -lquadmath clang: error: linker command failed with exit
code 1 (use -v to see invocation) make: *** [packfor.so] Error 1
ERROR: compilation failed for package ‘packfor’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/packfor’
>

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