3
votes

I have tried multiple ways to install the caret package in R. The error message that I receive is as follows:

Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘dimRed’

When I try to install dimRed, I get the following message:

Installing package into ‘C:/Users/Thomas/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependency ‘Biobase’ is not available

  There is a binary version available but the source version is later:
   binary source needs_compilation
dimRed  0.1.0  0.2.1             FALSE

installing the source package ‘dimRed’

trying URL 'https://cran.rstudio.com/src/contrib/dimRed_0.2.1.tar.gz'
Content type 'application/x-gzip' length 363025 bytes (354 KB)
downloaded 354 KB

ERROR: dependency 'Biobase' is not available for package 'dimRed' * removing 'C:/Users/Thomas/Documents/R/win-library/3.4/dimRed' In R CMD INSTALL Warning in install.packages : running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "C:\Users\Thomas\Documents\R\win-library\3.4" C:\Users\Thomas\AppData\Local\Temp\RtmpqKhsKn/downloaded_packages/dimRed_0.2.1.tar.gz' had status 1 Warning in install.packages : installation of package ‘dimRed’ had non-zero exit status

The downloaded source packages are in ‘C:\Users\Thomas\AppData\Local\Temp\RtmpqKhsKn\downloaded_packages’

Per previous posts, I have updated RStudio. I have attempted an install from install_url.

Any suggestions are welcome.

2
Have you tried installing biobase first? See the documentation for installation helpCIAndrews
These are confusing messages. Biobase is a Bioconductor package. Neither it, nor dimRed seem to be required for caret, according to its CRAN page. It sounds like your current R environment is just messed up. I would restart R and try again.neilfws
It's possible that one of the package required by caret(and there are a big boatload of them) does have dimRed as a dependency. I just installed caret and dimRed was installed during the dependencies phase. Si suggestions to reinstall my be a waste of time. (I did already have Biobase installed.)IRTFM
I ran install.packages("dimRed", dependencies = T) and now my base error message has changed to - > library("caret") Error: package or namespace load failed for ‘caret’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘Biobase’. When I try to install Biobase, I'm told that it is not available on R3.4.4. Any ideas?coult
I had a similar problem. In my case, as @neilfws mentioned, some of the libraries were likely open in my on-going RStudio session. I just re-started RStudio, used install.packages("caret", dependencies = TRUE) and all was fine.JASC

2 Answers

3
votes

I was able to figure this out. Simply typing install.packages won't work. In order to install Biobase, you have to run the following code in R console:

if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install("Biobase", version = "3.8")

More info: https://bioconductor.org/packages/release/bioc/html/Biobase.html

Once this step is done, I installed caret again using

install.packages("caret",dependencies = T)

And then it worked.

-1
votes

Warning ...

install.packages("BiocManager")

This only works if your R version is >= 3.5.0

for info I've the same problem under a Centos and a Windows. issue solved on the windows with 3.5.1 R version. Not yet solved on the centOS (3.4.2)