Rstan compile issues after updating to R 4.0.3

The first error message:

1)  Error in open.connection(con, open = mode) : 
  Could not resolve host: github.com

Is caused by rstan trying to connect to github to check your model against the new version of the compiler. The easiest fix here is to install the preview of the next rstan version which doesn’t make this check:

remove.packages(c("StanHeaders", "rstan"))
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

As for the second error:

2) Error in compileCode(f, code, language = language, verbose = verbose) : 
  cc1plus.exe: fatal error: \Balder/users/eterin/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: fileb14475603c26.o] Error 1

This happens when your R packages are installed to a directory on a networked drive, rather than locally installed to your computer. R can have difficulties in finding the necessary files during model compilation when this is the case.

If you still have the error after upgrading to the rstan preview, you will need to move your R package directory to a local directory on your computer. If you’re not sure how to do that, I put together an example/guide in this post: Modeling failed Warnings: 'C:/Users/R-34~1.3/rtools40/usr/mingw_/bin/g++' not found Errors: Multiple results for CXX14FLAGS found, something is wrong.FALSE - #54 by andrjohns

1 Like