Rstan on Windows


I’m trying to run a regression model in RStan, brms and getting the following error:

Error: protect(): protection stack overflow

Prior to posting this, I was getting something with undefined reference to tbb.

Tried looking at thread “RStan on Windows” and many of these tricks to not work, as I’m not able to edit the Makvars file with the file.edit command, and this is my first time using Windows for this purpose. Any suggestions as to where to look on the forums as to what to do?

Thank you in advanced.

Hi @drezap and welcome to the forum.

What compiler are you using? It seems you are missing tbb (Threading Building Blocks) which I guess would be included in the rtools bundle.
In any case, you could try to use the compiler that comes with the rtools package.
Also, it is Makevars, not sure if that was a type in the post or when you tried.
You could try to use edit_r_makevars() from the usethis package.

Hope that helps.

Can you try the steps in the Getting Started guide: Configuring C Toolchain for Windows · stan-dev/rstan Wiki · GitHub

perfect thank you!

Preview of rstan 2.26 worked.

install.packages("StanHeaders", repos = c("", getOption("repos")))
install.packages("rstan", repos = c("", getOption("repos")))