Installing packages in R gives the following errors - r

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 !

Related

Installing packages from source in renv

I need to install a package from source in renv. I can install packages from binaries in renv no problem. I can also install packages from both source & binary outside renv no problem. I am doing this within Rstudio
The error (below) makes me think it cant find the compiler. Digging around I found a thread about this that says renv cant find Rtools and then you need to run renv:::renv_scope_rtools() to resolve this but this just gives the message FAIL and the problem remains. Can anyone help?
thanks
install.packages("xfun")
Retrieving 'https://cloud.r-project.org/src/contrib/xfun_0.37.tar.gz' ...
OK [file is up to date]
Installing xfun [0.37] ...
FAILED
Error installing package 'xfun':
================================
* installing *source* package 'xfun' ...
** package 'xfun' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:253: base64.o] Error 127
ERROR: compilation failed for package 'xfun'
* removing 'D:/Dropbox/project X/renv/staging/3/xfun'

Can't install 'glmnet' in R

I put in this code:
install.packages("glmnet")
And it delivers this error message:
* installing *source* package 'glmnet' ...
** package 'glmnet' successfully unpacked and MD5 sums checked
** using staged installation
** libs
*** arch - i386
"c:/rtools40/mingw32/bin/"g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.4/include" -DNDEBUG -I'C:/Users/zac.t8/OneDrive/Documents/R/win-library/4.0/RcppEigen/include' -I'C:/Users/zac.t8/OneDrive/Documents/R/win-library/4.0/Rcpp/include' -Iglmnetpp/include -Iglmnetpp/src -Iglmnetpp/test -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
sh: c:/rtools40/mingw32/bin/g++: No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.4/etc/i386/Makeconf:229: RcppExports.o] Error 127
ERROR: compilation failed for package 'glmnet'
* removing 'C:/Users/zac.t8/OneDrive/Documents/R/win-library/4.0/glmnet'
Warning in install.packages :
installation of package ‘glmnet’ had non-zero exit status
Can someone point out what is wrong? Thanks!

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

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!

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?

ROracle : 64bit install on MacOSX 10.8 (Mountain Lion)

I have 64bit R (R version 2.15.2 (2012-10-26) -- "Trick or Treat") on Mac OSX 10.8.5, and Oracle Instantclient Version 11.2.0.3.0 from Oracle installed. I've gotten sqlplus, as well as Perl and Python to run on these. Now I am trying to build ROracle. It needs to be built from source, so I downloaded it and have tried running:
R CMD INSTALL ROracle_1.1-10.tar.gz
However, I think it is expecting a different directory structure than what the Instant Client has given me. For instance, when I try to run that command, I get:
$ R CMD INSTALL ROracle_1.1-10.tar.gz
* installing to library ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library’
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: error: "/Applications/instantclient_11_2/lib" directory does not exist
ERROR: configuration failed for package ‘ROracle’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/ROracle’
It is true, that I don't have a 'lib' directory in my '/Applications/instantclient_11_2' directory. I did however try to fake it out by creating one and linking to the .dylib files in the '/Applications/instantclient_11_2' directory, and I got past that error to a new one:
$ R CMD INSTALL ROracle_1.1-10.tar.gz
* installing to library ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library’
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: error: "/Applications/instantclient_11_2/rdbms/public" directory does not exist
ERROR: configuration failed for package ‘ROracle’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/ROracle’
So it is now looking for another directory that isn't there. I don't want to keep going and guessing at the directories it is expecting and trying to back-populate it with links to files it should be expecting in those directories (I don't even know what it might be expecting here).
Is there another way to go about installing this? I'm thinking I should be able to do this based upon the fact that Perl and Python can use these drivers.
Thanks,
Matt
I think you have "ORACLE_HOME" variable set. I had the same problem and as soon as I did
export ORACLE_HOME=""
I could successfully compile ROracle.
Before:
me#my-laptop:~/Downloads$ R CMD INSTALL ROracle_1.1-10.tar.gz
*installing to library ‘/opt/R/library’
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: error: "/usr/lib/oracle/12.1/rdbms/public" directory does not exist
ERROR: configuration failed for package ‘ROracle’
* removing ‘/opt/R/library/ROracle’
After:
me#my-laptop:~/Downloads$ export ORACLE_HOME=""
me#my-laptop:~/Downloads$ R CMD INSTALL ROracle_1.1-10.tar.gz
* installing to library ‘/opt/R/library’
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/opt/oracle/sdk/include -fpic -O2 -pipe -g -c rodbi.c -o rodbi.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/opt/oracle/sdk/include -fpic -O2 -pipe -g -c rooci.c -o rooci.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/opt/oracle/sdk/include -fpic -O2 -pipe -g -c routl.c -o routl.o
gcc -std=gnu99 -shared -o ROracle.so rodbi.o rooci.o routl.o -L/opt/oracle -lclntsh -L/usr/lib/R/lib -lR
installing to /opt/R/library/ROracle/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (ROracle)

Resources