This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Cannot Install MetaboAnalystR - Please help!

Hi there!

I am relatively new to R and I am having difficulty installing the MetabolAnalystR. Any help would be greatly appreciated. I have searched online and tried my best to install all of the package dependencies - but it still isnt working - my code so far is as follows:

if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install(c("impute","pcaMethods","globaltest","GlobalAncova","Rgraphviz","preprocessCore",
                      "genefilter","SSPA","sva","limma","KEGGgraph","siggenes","BiocParallel","MSnbase",
                      "multtest","RBGL","edgeR","fgsea","httr"))

install.packages("devtools")
library(devtools)

# install Rtools from https://cran.r-project.org/bin/windows/Rtools/ (Windows 64 bit)
## Define file path for Rtools
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
## Restart r
Sys.which("make")
find_rtools()

install.packages(c("pls","Rserve","ellipse","scatterplot3d","Cairo","randomForest","caTools","e1071","som",
                 "RJSONIO","ROCR","pheatmap","pROC","fitdistrplus","lars","Hmisc","caret","crmn"))

install.packages("igraph")
library("igraph") 

devtools::install_version('mnormt', version = "1.5-7", repos="http://cran.rstudio.com")

library("quantreg") 

install.packages(c("impute", "pcaMethods", "globaltest","GlobalAncova", 
                   "Rgraphviz", "preprocessCore", "genefilter", "SSPA", 
                   "sva", "limma", "KEGGgraph", "siggenes","BiocParallel", 
                   "MSnbase", "multtest","RBGL","edgeR","fgsea","httr","qs",
                   "metap","entropy","rsm","Rcpp","gplots","reshape","spls"))

package_dependencies <-(c("impute","pcaMethods","globaltest","GlobalAncova","Rgraphviz","preprocessCore",
                         "genefilter","SSPA","sva","limma","KEGGgraph","siggenes","BiocParallel","MSnbase",
                         "multtest","RBGL","edgeR","fgsea","httr","pls","Rserve","ellipse","scatterplot3d","Cairo","randomForest","caTools","e1071","som",
                         "RJSONIO","ROCR","pheatmap","pROC","fitdistrplus","lars","Hmisc","caret","crmn", "impute", "pcaMethods", "globaltest","GlobalAncova", 
                         "Rgraphviz", "preprocessCore", "genefilter", "SSPA", 
                         "sva", "limma", "KEGGgraph", "siggenes","BiocParallel", 
                         "MSnbase", "multtest","RBGL","edgeR","fgsea","httr","qs",
                         "metap","entropy","rsm","Rcpp","gplots","reshape","spls"))


lapply(package_dependencies, require, character.only = TRUE)


devtools::install_github("xia-lab/MetaboAnalystR", build = TRUE, build_vignettes = TRUE, build_manual =T)

The output (with warning message) is as follows:

Downloading GitHub repo xia-lab/MetaboAnalystR@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                           
2: CRAN packages only            
3: None                          
4: mnormt (1.5-7 -> 2.0.2) [CRAN]

Enter one or more numbers, or an empty line to skip updates:3
pdflatex not found! Not building PDF manual.
√  checking for file 'C:\Users\lewhi\AppData\Local\Temp\RtmpqUlmlM\remotes4f07551518a\xia-lab-MetaboAnalystR-88d36f8/DESCRIPTION' (1.1s)
-  preparing 'MetaboAnalystR': (27.1s)
√  checking DESCRIPTION meta-information ... OK
-  cleaning src
-  installing the package to build vignettes (15.4s)
         -----------------------------------
-  installing *source* package 'MetaboAnalystR' ...
   ** using staged installation
   ** libs
   "C:/rtools40/mingw64/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -fdiagnostics-color=always -c Internal_utils_batch.c -o Internal_utils_batch.o
   Internal_utils_batch.c:n function 'do_decorana
   Internal_utils_batch.c:114:3:warning: is 'foruse does not guard... [-Wmisleading-indentation
      for 0, nid = 0; i < nr*nc; i++)
      ^~~
   Internal_utils_batch.c:118:5:note: .this statement, but the latter is misleadingly indented as if it were guarded by the 'for
        intgin = (int *) R_alloc(nr, sizeof(int));
        ^~~
   "C:/rtools40/mingw64/bin/"gfortran  -fno-optimize-sibling-calls    -O2  -mfpmath=sse -msse2 -mstackrealign -c decorana.f -o decorana.o
   "C:/rtools40/mingw64/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -fdiagnostics-color=always -c init.c -o init.o
   "C:/rtools40/mingw64/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -fdiagnostics-color=always -c mzROI.c -o mzROI.o
   "C:/rtools40/mingw64/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -fdiagnostics-color=always -c util.c -o util.o
   "C:/rtools40/mingw64/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -fdiagnostics-color=always -c xcms_binners.c -o xcms_binners.o
   xcms_binners.c:11:1:warning: within comment [-Wcomment]
    /*

   xcms_binners.c:n function '_breaks_on_binSize
   xcms_binners.c:361:7:warning: used variable 'idx-Wunused-variable
      int idx
          ^~~
   C:/rtools40/mingw64/bin/gcc -shared -s -static-libgcc -o MetaboAnalystR.dll tmp.def Internal_utils_batch.o decorana.o init.o mzROI.o util.o xcms_binners.o -lgfortran -lm -lquadmath -LC:/PROGRA~1/R/R-40~1.2/bin/x64 -lR
   installing to C:/Users/lewhi/AppData/Local/Temp/RtmpA7MiaB/Rinst3bdc3bd5316b/00LOCK-MetaboAnalystR/00new/MetaboAnalystR/libs/x64
   ** R
   ** inst
   ** byte-compile and prepare package for lazy loading
   Warning in fun(libname, pkgname) :
     mzR has been built against a different Rcpp version (1.0.4.6)
   than is installed on your system (1.0.6). This might lead to errors
   when loading mzR. If you encounter such issues, please send a report,
   including the output of sessionInfo() to the Bioc support forum at 
   https://support.bioconductor.org/. For details see also
   https://github.com/sneumann/mzR/wiki/mzR-Rcpp-compiler-linker-issue.
   Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
     there is no package called 'ctc'
   Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
   Execution halted
   ERROR: lazy loading failed for package 'MetaboAnalystR'
-  removing 'C:/Users/lewhi/AppData/Local/Temp/RtmpA7MiaB/Rinst3bdc3bd5316b/MetaboAnalystR'
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'MetaboAnalystR' from GitHub:
  System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> https://support.bioconductor.org/. For details see also
E> https://github.com/sneumann/mzR/wiki/mzR-Rcpp-compiler-linker-issue.
E> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
E>   there is no package called 'ctc'
E> Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
E> Execution halted
E> ERROR: lazy loading failed for package 'MetaboAnalystR'
E> * removing 'C:/Users/lewhi/AppData/Local/Temp/RtmpA7MiaB/Rinst3bdc3bd5316b/MetaboAnalystR'
E>       -----------------------------------
E> ERROR: package installation failed

Can anyone help me with this? Thank you!

r

1 answer

If you read the error it says that the package ctc is missing. Install that from bioconductor and try the installation again.

Thank you for your reply, I have done this and now I get:

Error: Failed to install 'MetaboAnalystR' from GitHub:
  (converted from warning) cannot remove prior installation of package ‘mnormt’

Im not sure how to uninstall mnormt? (If thats what I need to do)

Thank you so much for your help!

You can use the remove.packages function to remove a library.

Its working now! Thank you for your help!!

Log in to answer this question.