I’m having trouble installing rstan on my Mac OS Catalina with R version 3.6.2. I’m following the instruction on this link and I’m getting an error when I try to install RcppArmadillo. It seems like there is a problem with installing cmath. Does anyone have suggestions on what to do in this case? Thanks so much!
According to @wds15, if you download
and
CTRL+right click on the file, then clicking “Open” will get the installer going
it will set things up for you.
Hi,
It’s still not working. I can install rstan but I get the following error:
library("rstan")
Loading required package: StanHeaders
Loading required package: ggplot2
rstan (Version 2.19.2, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
> fit <- stan(model_code = "data { vector[10] y;} parameters{real mu;} model{y~normal(mu,1);}", data = list(y = rnorm(10)))
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include/Eigen/Core:96:
In file included from /usr/local/clang7/include/c++/v1/complex:246:
/usr/local/clang7/include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace
using ::signbit;
~~^
/usr/local/clang7/include/c++/v1/cmath:314:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
~~^
/usr/local/clang7/include/c++/v1/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
~~^
/usr/local/include/math.h:749:12
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file1456127aef68.cpp 2> file1456127aef68.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
> pkgbuild::has_build_tools(debug = TRUE)
[1] TRUE
My Makevars file is
# clang: start
CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include
SHLIB_CXXLDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
SHLIB_CXX14LDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
# clang: end
and my sessionInfo is
> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.2
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.19.2 ggplot2_3.2.1 StanHeaders_2.21.0-1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 pillar_1.4.3 compiler_3.6.2 prettyunits_1.1.1
[5] tools_3.6.2 pkgbuild_1.0.6 lifecycle_0.1.0 tibble_2.1.3
[9] gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.3 cli_2.0.1
[13] rstudioapi_0.10 parallel_3.6.2 yaml_2.2.0 loo_2.2.0
[17] gridExtra_2.3 withr_2.1.2 dplyr_0.8.3 stats4_3.6.2
[21] grid_3.6.2 tidyselect_0.2.5 glue_1.3.1 inline_0.3.15
[25] R6_2.4.1 processx_3.4.1 fansi_0.4.1 purrr_0.3.2
[29] callr_3.4.1 magrittr_1.5 scales_1.1.0 ps_1.3.0
[33] matrixStats_0.55.0 assertthat_0.2.1 colorspace_1.4-1 lazyeval_0.2.2
[37] munsell_0.5.0 crayon_1.3.4