Hi there,
I’ve been having problems using R on a Windows computer that I haven’t been able to figure out just from browsing.
I’m currently using Windows 10, and R vers. 4.2.2
When I install rstan directly and run the test example with:
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
example(stan_model, package = "rstan", run.dontrun = TRUE)
I get a huge output which ultimately ends in the following error:
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
F:/Software/R/R-4.2.2/library/BH/include/boost/math/special_functions/gamma.hpp:2105:45: required from 'typename boost::math::tools::promote_args<RT1, RT2>::type boost::math::gamma_q(RT1, RT2) [with RT1 = double; RT2 = double; typename boost::math::tools::promote_args<RT1, RT2>::type = double]'F:/Software/R/R-4.2.2/library/StanHeaders/include/stan/math/prim/fun/gamma_q.hpp:55:77: required from hereF:/Software/R/R-4.2.2/library/BH/include/boost/math/tools/fraction.hpp:84:48: error: ‘long double’ is not a class, struct, or union type using value_type = typename T::value_type; ^make: *** [F:/Software/R/R-4.2.2/etc/x64/Makeconf:260: file71b01e0828ef.o] Error 1
On the github it says to install from source if we run into this issue, so I tried this after restarting:
# Compile packages using all cores
Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()))
install.packages(c("StanHeaders","rstan"),type="source")
But I end up seeing the packages still fail to install, ending its output with:
grammar_inst.cpp:3001:1: internal compiler error: Segmentation fault
} // namespace stan
^
Please submit a full bug report,
with preprocessed source if appropriate.
See http://sourceforge.net/projects/mingw-w64 for instructions.
make: *** [F:/Software/R/R-4.2.2/etc/x64/Makeconf:260: grammar_inst.o] Error 1
ERROR: compilation failed for package ‘rstan’
-removing ‘F:/Software/R/R-4.2.2/library/rstan’
Warning in install.packages :
installation of package ‘rstan’ had non-zero exit status
I’m really not sure what’s causing this, all the remedies I have found for others haven’t seemed to work so far. I’ve got it running completely fine on an Apple laptop as well.
Any direction or help would be much appreciated, thanks!