Caret package failed to install - r

I am getting this errors trying to install caret package:
ERROR: compilation failed for package ‘ddalpha’
* removing ‘/home/rspark/R/x86_64-redhat-linux-gnu-library/3.3/ddalpha’
Warning in install.packages :
installation of package ‘ddalpha’ had non-zero exit status
ERROR: dependency ‘ddalpha’ is not available for package ‘recipes’
* removing ‘/home/rspark/R/x86_64-redhat-linux-gnu-library/3.3/recipes’
Warning in install.packages :
installation of package ‘recipes’ had non-zero exit status
ERROR: dependency ‘recipes’ is not available for package ‘caret’
* removing ‘/home/rspark/R/x86_64-redhat-linux-gnu-library/3.3/caret’
Warning in install.packages :
installation of package ‘caret’ had non-zero exit status
Any ideas?
install.packages("ddalpha")
It gives the same error:
/usr/lib64/R/library/BH/include/boost/exception/exception.hpp:137: error: expected declaration before end of line
make: *** [AlphaProcedure.o] Error 1
ERROR: compilation failed for package ‘ddalpha’
* removing ‘/home/rspark/R/x86_64-redhat-linux-gnu-library/3.3/ddalpha’

I have found a solution.
I had the same problem. After installing caret with all its dependencies, ddalpha was not installed. Then I tried installing the package ddalpha alone. I got the message:
" There is a binary version available but the source version is later:
binary source needs_compilation
ddalpha 1.2.1 1.3.1 TRUE
Do you want to install from sources the package which needs compilation?
y/n: n"
Well, if I anwser yes, it doesn't work. But when I answer no, it does work. It looks like the new version has some problem, but the previous one works fine.

As Roman indicated in the comments, ddalpha and recipes are dependencies that aren't installed yet. You can manually install them as follows:
install.packages(c('ddalpha', 'recipes'))
Alternatively, you can tell the install.packages() command to grab the necessary packages during the install process.
install.packages('caret', dependencies=TRUE)
Or list them explicitly:
install.packages('caret', dependencies=c('ddalpha', 'recipes'))
Or, if you use an IDE such as RStudio, the package manager that's included will automatically handle these dependencies for you.
If these suggestions don't solve the problem, you may try updating your instance of R to the latest (3.4.1 as I write this). Also, ddalpha is dependent on the Rcpp package version 0.11.0 or greater, so you may update that package.
update.packages('Rcpp')

I was facing the same issues, and I had tried almost all the methods mentioned here. But the only one that worked for me was updating my IDE and that sorted it out.

I had the same issue, running
install.packages('caret', dependencies=TRUE)
from console solved it. I don't know why at the packages window install with "install dependencies" checked didn't work..
R studio: 2022.07.1
R: 3.6.3

Related

Unable to install the disgenet2r package

library(devtools)
install_bitbucket("ibi_group/disgenet2r")
Unable to install dependencies such as SPARQL
ERROR: dependency ‘SPARQL’ is not available for package ‘disgenet2r’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/disgenet2r’
Warning messages:
1: package ‘SPARQL’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
2: In i.p(...) :
installation of package ‘/var/folders/43/7hr3j7q17tn0ns1g67l5vbq80000gn/T//Rtmptk5KoF/file2d1b24460f94/disgenet2r_0.99.2.tar.gz’ had non-zero exit status
Installing of library(disgenet2r) for further OMIM research
OK, so, the version of something needs to change. I will assume your R version will remain fixed.
I don't know what version of SPARQL you're on, but this is the latest:
install.packages("https://cran.r-project.org/src/contrib/Archive/SPARQL/SPARQL_1.16.1.tar.gz", repos=NULL, type="source")
Try it again after that. If it's still not working then try:
install.packages("devtools")
devtools::install_version("disgenet2r", version = "0.99.1")

Installation issue with tidyverse package

I am having trouble installing packages, I was not able to install any. I got the following error in my r console:
ERROR: dependency 'cachem' is not available for package 'memoise'
* removing 'C:/Users/VasquezV/Documents/R/win-library/3.4/memoise'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\VasquezV\Documents\R\win-library\3.4" C:\Users\VasquezV\AppData\Local\Temp\1\RtmpuiYtO1/downloaded_packages/memoise_2.0.1.tar.gz' had status 1
Warning in install.packages :
installation of package ‘memoise’ had non-zero exit status
The major issue with this problem is that the cli package might not be updated as it often shows 3.1.1 installed but 3.3.0 required. Hence you have two solutions:
install.packages(cli) - there are chances that even this step
might fail as the error message is displayed: "Error in unpacking packages."
Uninstall Cran R and R studio and reinstall it or install the package for replacing the existing one to solve the issue.
This will definitely work as I have solved the issue through this way itself.

rgl installation in Mac: X11 not found

I am having the same problem as this and this.
I have installed R and rstudio through a conda environment which included r-rgl. I am now trying to install a package within R that requires rgl. However, calling library(rgl) gives the error
Error: package or namespace load failed for ‘rgl’:
package ‘rgl’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
I have tried to install rgl from within R, but then I get this message:
checking for X... no
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
* removing ‘/path/to/miniconda3/envs/my_conda_env/lib/R/library/rgl’
* restoring previous ‘/path/to/miniconda3/envs/my_conda_env/lib/R/library/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/vh/.../downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
The solution to the last error seems to be installing XQuartz in Mac, but I had it installed before. So I tried specifying install.packages("rgl", INSTALL_opts = "--with-libpng-prefix=/usr/X11/") but I still get the error above. Any suggestions? I'm quite lost now...
TL;DR: how do I connect my XQuartz installation with each conda environment that I create?

Unable to install ggm package un R language

I'm currently operating in macOS with the R version of 3.6.3.
When I tried to install the package ggm, a warning occurred as follows.
Warning in install.packages :
dependency ‘graph’ is not available
also installing the dependency ‘igraph’
Then when it completed installing, it seemed not to work either:
ERROR: compilation failed for package ‘igraph’
* removing ‘/usr/local/lib/R/3.6/site-library/igraph’
ERROR: dependencies ‘igraph’, ‘graph’ are not available for package ‘ggm’
* removing ‘/usr/local/lib/R/3.6/site-library/ggm’
What is happening? I have searched for this error and didn't find anything that helps. Please help me. I'll be much appreciated!
I had the same problem.
To install the package graph you need to install the latest version of Bioconductor (i.e. package called BioManager).
Then you install the package graph and then simply run the installation for the ggm package.
install.packages("BiocManager")
BiocManager::install("graph")
install.packages("ggm")
library(ggm)
The package is then loaded into your R enviroment.

Trying to install Rattle for R on my Mac

I'm trying to install Rattle and have been running into some issues. Below is the initial code and results.
install.packages('rattle', repo='https://cran.cnr.Berkeley.edu/')
also installing the dependency ‘RGtk2’
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘RGtk2’
Do you want to attempt to install these from sources?
I tried yes and the error it gave me is this
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’
Warning in install.packages :
installation of package ‘RGtk2’ had non-zero exit status
ERROR: dependency ‘RGtk2’ is not available for package ‘rattle’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rattle’
Warning in install.packages :
installation of package ‘rattle’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/47/39zt_y995czg2rgb3n485ty80000gn/T/Rtmpb8Eli0/downloaded_packages’
I also tried no and the error it gave me was this
ERROR: dependency ‘RGtk2’ is not available for package ‘rattle’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rattle’
Warning in install.packages :
installation of package ‘rattle’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/47/39zt_y995czg2rgb3n485ty80000gn/T/Rtmpb8Eli0/downloaded_packages’
Would anybody happen to know where I'm going wrong? Thank you in advance for any input.
My reputation is too low to comment, so I must post an answer. Zhiya's method worked for some of my students. It was not working for everyone, so we worked out a second method (thanks, Tugay!!)
The wrapper method of GW also was not working, perhaps because since it was compiled some of the versions have changed. (My theory is that all of the following must have versions that can interoperate: R, RGtk+, GTK, MacOS, Rattle. When any of them is updated on my system, Rattle may stop working. That's why you got this message
configure: error: GTK version 2.8.0 required
My blog post documenting what worked for me is here. It works with: MacOS 10.13.4,R 3.4.4, Rattle 5.1.3, RGtk2 2.24.32. YMMV.
I am sure that if I knew some UNIX, I could have gotten other methods to work as well. Again, the apparent problem is that as of today there are not up-to-date versions of RGtk2 and GTK that are compiled for the latest MacOS. A suitable compiled version does exist for Windows and is in the CRAN repository. Solving the error messages requires compiling the missing programs from their source code versions on CRAN.

Resources