Hello. I’ve been trying unsuccessfully to install RStan. I’m using the latest version of R (version 4.0.3) and RStudio (version 1.3.1093) on a PC running Windows 10 and I followed all the instructions at
which sent me to
where I also followed the instructions. For example when I run Sys.getenv(“BINPREF”) I get ``` as desired, and the RTools4 installation also went fine with the check install.packages(“jsonlite”, type = “source”) going through ok.
I then installed RSTAN from source via
install.packages(“rstan”, type = “source”)
It seemed to go fine. BUt when I ran the demo code
library(rstan)
example(stan_model,run.dontrun = TRUE)
the rstan library wasn’t recognized. So this was unexpected and I just tried installing rstan directly via Tools -> Install packages from RStudio. This went fine and I’ve checked that rstan, StanHeaders and inline packages are at or above the required versions. But when I run the demo code again, i.e.
library(rstan)
example(stan_model,run.dontrun = TRUE)
I obtain the following error
“Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
cc1plus.exe: fatal error: \icnas2.cc.ic.ac.uk/mhaugh/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp: No such file or directorycompilation terminated.make: *** [C:/PROGRA~1/R/R-40~1.3/etc/x64/Makeconf:229: file795037b99fe.o] Error 1
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found”
I actually have tried installing it a couple of times, but am at a loss. This is probably my third attempt over the past 3-4 years and each time I fail. I’ve never had any issues installing other software, Python packages etc. but RStan and I think MatlabStan has always defeated me. Any ideas?
Thanks