MetaboAnalystR - Installation issue (package ‘MSnbase’ is not available for this version of R)

Hi, I am new to metabolomics research. When I try to install MetaboAnalyst using the following code, it returns an error because “A package ‘MSnbase’ is not available for this version of R”.

devtools::install_github("xia-lab/MetaboAnalystR", build = TRUE, build_vignettes = TRUE, build_manual =T)
Installing package into ‘/usr/local/lib/R/4.2/site-library’
(as ‘lib’ is unspecified)
ERROR: dependency ‘MSnbase’ is not available for package ‘MetaboAnalystR’
* removing ‘/usr/local/lib/R/4.2/site-library/MetaboAnalystR’
Warning messages:
1: package ‘MSnbase’ 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/n5/w7wbnl8956x5xtgwp11w9b2c0000gn/T//RtmpklVsEI/file15b5550b77a3/MetaboAnalystR_3.2.0.tar.gz’ had non-zero exit status

I am using:
• R version 4.2.1 (2022-06-23) – “Funny-Looking Kid”
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin21.5.0 (64-bit)
• RStudio 2022.07.1+554 “Spotted Wakerobin” Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for macOS
• Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4_0) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

Thank you in advance.

Hi Rik,

R package MSnbase is available from Bioconductor. Please follow this instruction (Bioconductor - MSnbase) to install it.

Zhiqiang

1 Like

Thank you Zhiqiang. That is solved.
However, another error persists. I will make another thread if needed.

devtools::install_github("xia-lab/MetaboAnalystR", build = TRUE, build_vignettes = TRUE, build_manual =T)
In file included from <built-in>:1:
In file included from /usr/local/lib/R/4.2/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /usr/local/lib/R/4.2/site-library/RcppEigen/include/Eigen/Dense:1:
In file included from /usr/local/lib/R/4.2/site-library/RcppEigen/include/Eigen/Core:88:
/usr/local/lib/R/4.2/site-library/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:1: error: unknown type name 'namespace'
namespace Eigen {
^
/usr/local/lib/R/4.2/site-library/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:16: error: expected ';' after top level declarator
namespace Eigen {
               ^
               ;
In file included from <built-in>:1:
In file included from /usr/local/lib/R/4.2/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /usr/local/lib/R/4.2/site-library/RcppEigen/include/Eigen/Dense:1:
/usr/local/lib/R/4.2/site-library/RcppEigen/include/Eigen/Core:96:10: fatal error: 'complex' file not found
#include <complex>
         ^~~~~~~~~
3 errors generated.
make: *** [c/Internal_utils_batch.o] Error 1
ERROR: compilation failed for package ‘MetaboAnalystR’
* removing ‘/usr/local/lib/R/4.2/site-library/MetaboAnalystR’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/n5/w7wbnl8956x5xtgwp11w9b2c0000gn/T//RtmpDvdKfI/file177ec4b0558f1/MetaboAnalystR_3.2.0.tar.gz’ had non-zero exit status

Based on your error, I noticed you are using MacOS, and the c++ library is missing. This is related to the missing dependency for RcppEigen to complie the source code. Please check your compiler and the corresponding library associated with the header ().

1 Like

Thank you so much! I made it!
For someone having similar issues, what I eventually did was just launching Xcode and did install.packages(“RcppEigen”) - I have no sense why worked.