R install ggplot, ft2build.h not found (OS X) - r

I am trying to install ggplot package in R but I got the following error
install.packages('ggplot2',dependencies = TRUE)
* installing *source* package ‘gdtools’ ...
** package ‘gdtools’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=-I/usr/local/opt/cairo/include/cairo
Using PKG_LIBS=-L/usr/local/opt/cairo/lib -lcairo
** libs
clang++ -I/usr/local/Cellar/r/3.3.1_2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/cairo/include/cairo -I../inst/include/ -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c CairoContext.cpp -o CairoContext.o
clang++ -I/usr/local/Cellar/r/3.3.1_2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/cairo/include/cairo -I../inst/include/ -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -I/usr/local/Cellar/r/3.3.1_2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/cairo/include/cairo -I../inst/include/ -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c font_metrics.cpp -o font_metrics.o
In file included from font_metrics.cpp:3:
/usr/local/opt/cairo/include/cairo/cairo-ft.h:46:10: fatal error: 'ft2build.h'
file not found
#include <ft2build.h>
^
1 error generated.
make: *** [font_metrics.o] Error 1
ERROR: compilation failed for package ‘gdtools’
* removing ‘/usr/local/lib/R/3.3/site-library/gdtools’
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (ggplot2)
ERROR: dependency ‘gdtools’ is not available for package ‘svglite’
* removing ‘/usr/local/lib/R/3.3/site-library/svglite’
The downloaded source packages are in
‘/private/var/folders/mm/8gjs_s_s01x3_qr4xrdky88c0000gn/T/RtmpwQObj5/downloaded_packages’
Warning messages:
1: In install.packages("ggplot2", dependencies = TRUE) :
installation of package ‘gdtools’ had non-zero exit status
2: In install.packages("ggplot2", dependencies = TRUE) :
installation of package ‘svglite’ had non-zero exit status
I installed R by following the instruction in this page: Installing R with Homebrew
brew tap homebrew/science
brew install Caskroom/cask/xquartz
brew install r
Can anyone shed me some light on this? thanks so much!

Related

Error installing Hmisc package in R Studio

I'm new in R and I've been having some issues installing Hmisc package in order to elaborate a Spearman's correlation heatmap. The warning and error are as follows:
18 warnings generated.
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c bilinear.f -o bilinear.o
make: gfortran: No such file or directory
make: *** [bilinear.o] Error 1
ERROR: compilation failed for package ‘interp’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/interp’
Warning in install.packages :
installation of package ‘interp’ had non-zero exit status
* installing *source* package ‘polspline’ ...
** package ‘polspline’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c allpack.f -o allpack.o
make: gfortran: No such file or directory
make: *** [allpack.o] Error 1
ERROR: compilation failed for package ‘polspline’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/polspline’
Warning in install.packages :
installation of package ‘polspline’ had non-zero exit status
* installing *source* package ‘VGAM’ ...
** package ‘VGAM’ 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/usr/local/include -fPIC -Wall -g -O2 -c VGAM_init.c -o VGAM_init.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c caqo3.c -o caqo3.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c ei.f -o ei.o
make: gfortran: No such file or directory
make: *** [ei.o] Error 1
ERROR: compilation failed for package ‘VGAM’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/VGAM’
Warning in install.packages :
installation of package ‘VGAM’ had non-zero exit status
ERROR: dependency ‘interp’ is not available for package ‘latticeExtra’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/latticeExtra’
Warning in install.packages :
installation of package ‘latticeExtra’ had non-zero exit status
ERROR: dependency ‘latticeExtra’ is not available for package ‘Hmisc’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Hmisc’
Warning in install.packages :
installation of package ‘Hmisc’ had non-zero exit status
ERROR: dependencies ‘Hmisc’, ‘polspline’ are not available for package ‘rms’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rms’
Warning in install.packages :
installation of package ‘rms’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/8b/43x_77fx1p73gb68h2418m5r0000gn/T/RtmpIhACeD/downloaded_packages.
PS. I'm also a Mac user, and I've trying to solve it as some of you guys have suggested in other similar questions,
I've used:
-adding dependencies=true in the script.
-installing tydiverse package
-installing backports

mvtnorm installation in R, error trying to exec gfortran-4.2 Bad CPU type in executable

I have just installed R using brew and try to install mvtnorm package, but I get the following error:
Any suggestions how to solve this?
> install.packages("mvtnorm")
Installing package into ‘/usr/local/lib/R/4.1/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/mvtnorm_1.1-2.tar.gz'
Content type 'application/x-gzip' length 166202 bytes (162 KB)
==================================================
downloaded 162 KB
* installing *source* package ‘mvtnorm’ ...
** package ‘mvtnorm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/usr/local/Cellar/r/4.1.0/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 -fPIC -Wno-implicit-function-declaration -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
clang -I"/usr/local/Cellar/r/4.1.0/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 -fPIC -Wno-implicit-function-declaration -c miwa.c -o miwa.o
gfortran -fno-optimize-sibling-calls -fPIC -g -O2 -c mvt.f -o mvt.o
gfortran-4.2: error trying to exec '/usr/local/bin/i686-apple-darwin8-gfortran-4.2': execvp: Bad CPU type in executable
make: *** [mvt.o] Error 255
ERROR: compilation failed for package ‘mvtnorm’
* removing ‘/usr/local/lib/R/4.1/site-library/mvtnorm’
Warning in install.packages :
installation of package ‘mvtnorm’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/4l/y1pqv07934x_2qv3bzj_93s40000gn/T/RtmpHUys7l/downloaded_packages’
>
Finally, I installed gfortran 10.2 (thanks to https://github.com/fxcoudert/gfortran-for-macOS/issues/17) now I am able to install mvtnorm and some other packages having the same problem.

Installing packages in R gives the following errors

When trying to install some packages such Rcmdr or factoextra while on R in terminal (after upgrade to R 4.0.0 on Archlabs) the following errors shows up:
* installing *source* package ‘SparseM’ ...
** package ‘SparseM’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fno-optimize-sibling-calls -fpic -g -O2 -c bckslv.f -o bckslv.o
/usr/local/bin/gfortran: /usr/local/bin/gfortran: cannot execute binary file
make: *** [/usr/lib64/R/etc/Makeconf:190: bckslv.o] Error 126
ERROR: compilation failed for package ‘SparseM’
* removing ‘/usr/lib/R/library/SparseM’
and this one :
* installing *source* package ‘readr’ ...
** package ‘readr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/BH/include' -D_FORTIFY_SOURCE=2 -I. -Ircon -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c Collector.cpp -o Collector.o
In file included from /usr/lib/R/library/Rcpp/include/Rcpp.h:77,
from Collector.cpp:1:
/usr/lib/R/library/Rcpp/include/Rcpp/Rmath.h: In function ‘double R::pythag(double, double)’:
/usr/lib/R/library/Rcpp/include/Rcpp/Rmath.h:222:57: error: ‘::Rf_pythag’ has not been declared; did you mean ‘pythag’?
222 | inline double pythag(double a, double b) { return ::Rf_pythag(a, b); }
| ^~~~~~~~~
| pythag
make: *** [/usr/lib64/R/etc/Makeconf:176: Collector.o] Error 1
then followed by a bunch of
ERROR: dependencies ‘dendextend’, ‘FactoMineR’, ‘ggpubr’, ‘ggrepel’, ‘tidyr’ are not available for package ‘factoextra’
* removing ‘/usr/lib/R/library/factoextra’
following each dependencies produces the same errors with different new dependencies.
P.S: I'm a normie so please bear with me.
I had a similar error while installing 'ape'. For me it worked to reinstall the current version of the 'Rcpp' package:
install.packages('Rcpp')
Hope it works for you too !

Error in installing H2O ai R package in BigInsights cluster in Bluemix

I have a 5 node BigInsights hadoop cluster in Bluemix. I am getting error, when I am trying to install H2O ai R in BigInsights cluster.
install.packages("h2o", type="source", repos=(c("http://h2o-release.s3.amazonaws.com/h2o/rel-turing/3/R")))
ERROR: dependencies ‘statmod’, ‘RCurl’, ‘jsonlite’ are not available for package ‘h2o’
* removing ‘/home/opus/R/x86_64-redhat-linux-gnu-library/3.3/h2o’
The downloaded source packages are in
‘/tmp/RtmpJmcuyB/downloaded_packages’
Warning message:
In install.packages("h2o", type = "source", repos = (c("http://h2o-release.s3.amazonaws.com/h2o/rel-turing/3/R"))) :
installation of package ‘h2o’ had non-zero exit status
When I try to install 'RCurl' package of R in BigInsights cluster, getting the error message as:
trying URL 'https://cran.fhcrc.org/src/contrib/RCurl_1.95-4.8.tar.gz'
Content type 'application/x-gzip' length 916934 bytes (895 KB)
==================================================
downloaded 895 KB
* installing *source* package ‘bitops’ ...
** package ‘bitops’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c bit-ops.c -o bit-ops.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c cksum.c -o cksum.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -o bitops.so bit-ops.o cksum.o -L/usr/lib64/R/lib -lR
installing to /home/opus/R/x86_64-redhat-linux-gnu-library/3.3/bitops/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
converting help for package ‘bitops’
finding HTML links ... done
bitAnd html
bitFlip html
bitShiftL html
cksum html
** building package indices
** testing if installed package can be loaded
* DONE (bitops)
* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/opus/R/x86_64-redhat-linux-gnu-library/3.3/RCurl’
The downloaded source packages are in
‘/tmp/RtmpJmcuyB/downloaded_packages’
Warning message:
In install.packages("RCurl") :
installation of package ‘RCurl’ had non-zero exit status
Please help me to resolve the issue and help would be much appreciated.
It looks like you are trying to install on Linux.
You need to install the development files for libcurl first.
eg
apt-get install libcurl4-openssl-dev
or
yum install libcurl-devel

Non zero exit status error when installing a package in linux

I just installed R on linux. Now I try to install some packages on it. When I try on install the
the RCurl package using:
install.packages("RCurl")
I however get the following:
* installing *source* package ‘bitops’ ...
** package ‘bitops’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c bit-ops.c -o bit-ops.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c cksum.c -o cksum.o
gcc -std=gnu99 -shared -o bitops.so bit-ops.o cksum.o -L/usr/lib/R/lib -lR
installing to /home/marc/R/x86_64-pc-linux-gnu-library/3.0/bitops/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (bitops)
* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/marc/R/x86_64-pc-linux-gnu-library/3.0/RCurl’
The downloaded source packages are in
‘/tmp/RtmpAXtKXQ/downloaded_packages’
Warning message:
In install.packages("RCurl") :
installation of package ‘RCurl’ had non-zero exit status
In the beginning everything seems to go fine but then I trows a non-zero exit status error. Any thoughts
what goes wrong here?

Resources