RStan aborting in RStudio

I’ve tried to install RStan with some success in that I can load the library and read the help vignettes. However, when I try to run a basic .stan file (e.g., 8schools.stan example), it crashes my RStudio.

I’ve followed the instructions from https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started. It asks me to install additional build tools, which I’ve accepted. It then asks if I want to reinstall Rtools, which I do. Everything appears to be OK. I set up the parameters and then I run the .stan file and, moments later, RStudio crashes. Any information on how to get around this issue?

  • Windows 10 (Version: 1709; Build: 16299.611)
  • RStan Version (2.18.2)
  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
  • No such file or directory
  • Output of devtools::session_info("rstan")
  • See below:

  • Session info -------------------------------------------------------------------------------------------------------------
    setting value
    version R version 3.5.1 (2018-07-02)
    os Windows >= 8 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate English_United States.1252
    ctype English_United States.1252
    tz America/New_York
    date 2019-03-26

  • Packages -----------------------------------------------------------------------------------------------------------------
    package * version date lib source
    assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.1)
    backports 1.1.2 2017-12-13 [1] CRAN (R 3.5.0)
    base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.5.0)
    BH 1.69.0-1 2019-01-07 [1] CRAN (R 3.5.2)
    callr 3.0.0 2018-08-24 [1] CRAN (R 3.5.1)
    cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.2)
    colorspace 1.4-0 2019-01-13 [1] CRAN (R 3.5.2)
    crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.1)
    desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.1)
    digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.2)
    fansi 0.4.0 2018-10-05 [1] CRAN (R 3.5.2)
    ggplot2 * 3.0.0 2018-07-03 [1] CRAN (R 3.5.1)
    glue 1.3.0 2018-07-17 [1] CRAN (R 3.5.1)
    gridExtra 2.3 2017-09-09 [1] CRAN (R 3.5.1)
    gtable 0.2.0 2016-02-26 [1] CRAN (R 3.5.1)
    inline 0.3.15 2018-05-18 [1] CRAN (R 3.5.2)
    labeling 0.3 2014-08-23 [1] CRAN (R 3.5.0)
    lattice 0.20-35 2017-03-25 [2] CRAN (R 3.5.1)
    lazyeval 0.2.1 2017-10-29 [1] CRAN (R 3.5.1)
    loo 2.0.0 2018-04-11 [1] CRAN (R 3.5.2)
    magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.2)
    MASS 7.3-50 2018-04-30 [2] CRAN (R 3.5.1)
    Matrix 1.2-14 2018-04-13 [2] CRAN (R 3.5.1)
    matrixStats 0.54.0 2018-07-23 [1] CRAN (R 3.5.2)
    mgcv 1.8-24 2018-06-23 [2] CRAN (R 3.5.1)
    munsell 0.5.0 2018-06-12 [1] CRAN (R 3.5.1)
    nlme 3.1-137 2018-04-07 [1] CRAN (R 3.5.3)
    pillar 1.3.1 2018-12-15 [1] CRAN (R 3.5.2)
    pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.1)
    pkgconfig 2.0.2 2018-08-16 [1] CRAN (R 3.5.1)
    plyr 1.8.4 2016-06-08 [1] CRAN (R 3.5.1)
    prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.1)
    processx 3.2.0 2018-08-16 [1] CRAN (R 3.5.1)
    ps 1.1.0 2018-08-10 [1] CRAN (R 3.5.1)
    R6 2.2.2 2017-06-17 [1] CRAN (R 3.5.1)
    RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 3.5.0)
    Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.2)
    RcppEigen 0.3.3.5.0 2018-11-24 [1] CRAN (R 3.5.2)
    reshape2 1.4.3 2017-12-11 [1] CRAN (R 3.5.1)
    rlang 0.3.1 2019-01-08 [1] CRAN (R 3.5.2)
    rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.1)
    rstan * 2.18.2 2018-11-07 [1] CRAN (R 3.5.3)
    scales 1.0.0 2018-08-09 [1] CRAN (R 3.5.2)
    StanHeaders * 2.18.1 2019-01-28 [1] CRAN (R 3.5.2)
    stringi 1.1.7 2018-03-12 [1] CRAN (R 3.5.0)
    stringr 1.3.1 2018-05-10 [1] CRAN (R 3.5.1)
    tibble 2.0.1 2019-01-12 [1] CRAN (R 3.5.2)
    utf8 1.1.4 2018-05-24 [1] CRAN (R 3.5.1)
    viridisLite 0.3.0 2018-02-01 [1] CRAN (R 3.5.1)
    withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.1)

I would try running it from Rterm to see if there is any message printed. Also, if you call tempdir() before running Stan, you can see where the temporary directory is and there might be some information printed in the text files. There are some crashes with ODE functions on Windows, but it shouldn’t happen on just regular Stan programs.