Unable to install mclust package in rstudio - r

I am having an issue when installing the "mclust" package on rstudio.
Here is the warning message:
>install.packages("mclust")
trying URL 'https://cran.rstudio.com/src/contrib/mclust_5.4.tar.gz'
Content type 'application/x-gzip' length 2535477 bytes (2.4 MB)
==================================================
downloaded 2.4 MB
* installing *source* package ‘mclust’ ...
** package ‘mclust’ successfully unpacked and MD5 sums checked
** libs
/home/usr/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -
I/home/usr/anaconda3/lib/R/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2
-I/home/usr/anaconda3/include -fpic -march=nocona -mtune=haswell -
ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -
I/home/usr/anaconda3/include -c init.c -o init.o
make: /home/usr/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc: Command
not found
/home/usr/anaconda3/lib/R/etc/Makeconf:160: recipe for target 'init.o'
failed
make: *** [init.o] Error 127
ERROR: compilation failed for package ‘mclust’
* removing ‘/home/usr/anaconda3/lib/R/library/mclust’
Warning in install.packages :
installation of package ‘mclust’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpGCCIZS/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
In addition, I also tried to access the directory /home.usr/anaconda3/x86_64-conda_cos6-linux-gnu-cc ,which apparently doesn't exist.

Related

install package on windows ERROR: compilation failed for packages

> install.packages(c("lubridate", "nlme", "readxl", "sourcetools", "utf8", "xfun"))
Installing packages into ‘C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
There are binary versions available but the source versions are later:
binary source needs_compilation
lubridate 1.9.1 1.9.2 TRUE
nlme 3.1-161 3.1-162 TRUE
readxl 1.4.1 1.4.2 TRUE
sourcetools 0.1.7 0.1.7-1 TRUE
utf8 1.2.2 1.2.3 TRUE
xfun 0.36 0.37 TRUE
installing the source packages ‘lubridate’, ‘nlme’, ‘readxl’, ‘sourcetools’, ‘utf8’, ‘xfun’
trying URL 'https://cran.rstudio.com/src/contrib/lubridate_1.9.2.tar.gz'
Content type 'application/x-gzip' length 427200 bytes (417 KB)
downloaded 417 KB
trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-162.tar.gz'
Content type 'application/x-gzip' length 848546 bytes (828 KB)
downloaded 828 KB
trying URL 'https://cran.rstudio.com/src/contrib/readxl_1.4.2.tar.gz'
Content type 'application/x-gzip' length 2091835 bytes (2.0 MB)
downloaded 2.0 MB
trying URL 'https://cran.rstudio.com/src/contrib/sourcetools_0.1.7-1.tar.gz'
Content type 'application/x-gzip' length 24095 bytes (23 KB)
downloaded 23 KB
trying URL 'https://cran.rstudio.com/src/contrib/utf8_1.2.3.tar.gz'
Content type 'application/x-gzip' length 241412 bytes (235 KB)
downloaded 235 KB
trying URL 'https://cran.rstudio.com/src/contrib/xfun_0.37.tar.gz'
Content type 'application/x-gzip' length 130063 bytes (127 KB)
downloaded 127 KB
* installing *source* package 'lubridate' ...
** package 'lubridate' 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 datetime.c -o datetime.o
/bin/sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:253: datetime.o] Error 127
ERROR: compilation failed for package 'lubridate'
* removing 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/lubridate'
* restoring previous 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/lubridate'
Warning in install.packages :
installation of package ‘lubridate’ had non-zero exit status
* installing *source* package 'nlme' ...
** package 'nlme' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fno-optimize-sibling-calls -O2 -mfpmath=sse -msse2 -mstackrealign -c chol.f -o chol.o
make: gfortran: No such file or directory
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:277: chol.o] Error 127
ERROR: compilation failed for package 'nlme'
* removing 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/nlme'
* restoring previous 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/nlme'
Warning in install.packages :
installation of package ‘nlme’ had non-zero exit status
* installing *source* package 'readxl' ...
** package 'readxl' successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/cpp11/include' -I'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/progress/include' -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c cpp11.cpp -o cpp11.o
/bin/sh: line 1: g++: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:260: cpp11.o] Error 127
ERROR: compilation failed for package 'readxl'
* removing 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/readxl'
* restoring previous 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/readxl'
Warning in install.packages :
installation of package ‘readxl’ had non-zero exit status
* installing *source* package 'sourcetools' ...
** package 'sourcetools' successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -I../inst/include -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c Reader.cpp -o Reader.o
/bin/sh: line 1: g++: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:260: Reader.o] Error 127
ERROR: compilation failed for package 'sourcetools'
* removing 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/sourcetools'
* restoring previous 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/sourcetools'
Warning in install.packages :
installation of package ‘sourcetools’ had non-zero exit status
* installing *source* package 'utf8' ...
** package 'utf8' 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" -Iutf8lite/src -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c as_utf8.c -o as_utf8.o
/bin/sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:253: as_utf8.o] Error 127
ERROR: compilation failed for package 'utf8'
* removing 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/utf8'
* restoring previous 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/utf8'
Warning in install.packages :
installation of package ‘utf8’ had non-zero exit status
* 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
/bin/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 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/xfun'
* restoring previous 'C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2/xfun'
Warning in install.packages :
installation of package ‘xfun’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\Sachin Dahiya\AppData\Local\Temp\RtmpgBGXsJ\downloaded_packages’
I am using R version 4.2.2 and R tools43 on Windows 11. These packages have been asking for updates for a while now but the compliation fails every time. Please let me know how to fix this issue. I have instaled R tools and R.4.2.2 in C:\Program Files\R.
These are my paths:
> .libPaths()
[1] "C:/Users/Sachin Dahiya/AppData/Local/R/win-library/4.2"
[2] "C:/Program Files/R/R-4.2.2/library"

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.

Unable to install a package called 'hemp' in R

I am new to learning R and i get the following error while installing the package called 'hemp'. Its a package which is used in psychometric analysis. Can anyone tell me what causes this errror?
Downloading GitHub repo cddesja/hemp#master
Installing 1 packages: nloptr
Installing package into ‘C:/Users/UJJWAL/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
There is a binary version available but the
source version is later:
binary source needs_compilation
nloptr 1.2.2.1 1.2.2.2 TRUE
installing the source package ‘nloptr’
trying URL 'https://cran.rstudio.com/src/contrib/nloptr_1.2.2.2.tar.gz'
Content type 'application/x-gzip' length 2450931 bytes (2.3 MB)
downloaded 2.3 MB
* installing *source* package 'nloptr' ...
** package 'nloptr' successfully unpacked and MD5 sums checked
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
*** arch - i386
/mingw32/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c dummy.cpp -o dummy.o
/mingw32/bin/gcc -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -I"/i386/include" -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init_nloptr.c -o init_nloptr.o
init_nloptr.c:35:10: fatal error: nlopt.h: No such file or directory
#include "nlopt.h"
^~~~~~~~~
compilation terminated.
make: *** [C:/PROGRA~1/R/R-4.0.2/etc/i386/Makeconf:222: init_nloptr.o] Error 1
ERROR: compilation failed for package 'nloptr'
* removing 'C:/Users/UJJWAL/Documents/R/win-library/4.0/nloptr'
Error: Failed to install 'hemp' from GitHub:
(converted from warning) installation of package ‘nloptr’ had non-zero exit status
Seems that it wouldbe a little harder to install nloptr on Windows. It require nlopt to be installed first. See this for more info: https://www.r-project.org/nosvn/pandoc/nloptr.html

gcc can't compile R packages under Linux Mint: can't find stdlib.h

I'm trying to install the R package gtools from the Linux Mint command line. After choosing the closest CRAN mirror, I'm getting the error message that no such file or directory was found and that installation of the package had a non-zero exit status. More specifically:
> install.packages('gtools')
Installing package into ‘/home/lizi/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cloud.r-
project.org/src/contrib/gtools_3.5.0.tar.gz'
Content type 'application/x-gzip' length 64855 bytes (63 KB)
==================================================
downloaded 63 KB
* installing *source* package ‘gtools’ ...
** package ‘gtools’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c roman2int.c -o roman2int.o
In file included from roman2int.c:1:0:
/usr/share/R/include/R.h:55:80: fatal error: stdlib.h: No such file or
directory
compilation terminated.
/usr/lib/R/etc/Makeconf:159: recipe for target 'roman2int.o' failed
make: *** [roman2int.o] Error 1
ERROR: compilation failed for package ‘gtools’
* removing ‘/home/lizi/R/x86_64-pc-linux-gnu-library/3.4/gtools’
The downloaded source packages are in
‘/tmp/Rtmp0z5PS6/downloaded_packages’
Warning message:
In install.packages("gtools") :
installation of package ‘gtools’ had non-zero exit status
The package has no dependencies, and I was under the impression that install.packages was straightforward. What am I doing wrong?

An error when install R package forecast on AWS instance

install.packages('forecast')
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/forecast_5.4.tar.gz'
Content type 'application/x-gzip' length 150965 bytes (147 Kb)
opened URL
downloaded 147 Kb
installing source package ‘forecast’ ...
package ‘forecast’ successfully unpacked and MD5 sums checked
libs
g++ -m64 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/RcppArmadillo/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c calcBATS.cpp -o calcBATS.o
In file included from calcBATS.cpp:1:0:
calcBATS.h:36:27: fatal error: RcppArmadillo.h: No such file or directory
#include
^
compilation terminated.
make: * [calcBATS.o] Error 1
ERROR: compilation failed for package ‘forecast’
* removing ‘/usr/lib64/R/library/forecast’
The downloaded source packages are in
‘/tmp/RtmpJRX18M/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("forecast") :
installation of package ‘forecast’ had non-zero exit status
Looks like there is a missing package dependence, RcppArmadillo.
install.packages("RcppArmadillo")
Then:
install.packages('forecast')
add within your lifecycle configuration
conda install -y -c r r-forecast

Resources