Hello. I am trying to install rstan fresh on a new machine. I have followed all the steps given here (RStan Getting Started · stan-dev/rstan Wiki · GitHub) but I cannot get the test model to run (example(stan_model, package = "rstan", run.dontrun = TRUE), nor can I get any of my own models to run.
Using my own models, I get the following error:
Error in compileCode(f, code, language = language, verbose = verbose) : Error in sink(type = "output") : invalid connection
To be clear, I have tried to install rstan both normally and from source. From what I can tell, it actually installs without any issues.
Operating system: Windows 11
RStan version: 2.21.8 seems to be installed
Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars"))):
Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'C:/Users/user/Documents/.R/Makevars': No such file or directory
pkgbuild::check_build_tools(debug = TRUE)
Scanning R CMD config CC…
‘’ does not exist
Found C:/rtools42 for 4.2
Found C:/rtools43 for 4.3.5550
Your system is ready to build packages!
pkgbuild::check_compiler(debug = TRUE)
Trying to compile a simple C file
Running “C:/PROGRA~1/R/R-43~1.0/bin/x64/Rcmd.exe” SHLIB foo.c
Error: Failed to compile C code
It seems to be referring also to rtools42 which I think I installed by mistake first but then uninstalled and deleted the files. I wonder if that is causing problems?
Wow, it really doesn’t want to find your toolchain. All I can think of now is to check your path and config, after that the only option might be to try completely uninstalling and re-installing both R and Rtools.
readLines("~/.Rprofile"): Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘C:/Users/user/Documents/.Rprofile’: No such file or directory
I don’t mind doing a fresh install if it’s needed. I’ve never had this much trouble getting stan installed though, its weird.