Problems installing cmdstan on Windows 11

I am running R 4.2.2 on a Windows 11 Machine. I am trying to follow along with the cmdstanr and cmdstan installation instructions but can’t seem to get cmdstan to install.

I successfully installed cmdstanr into my renv project environment. Now, according to the documentation, I need to install cmdstan.

When I do so, I recieve the following error:

> install_cmdstan( cores = 4, overwrite = T)
The C++ toolchain required for CmdStan is setup properly!
* Latest CmdStan release is v2.31.0
* Installing CmdStan v2.31.0 in C:\Users\damon\Documents/.cmdstan/cmdstan-2.31.0
* Downloading cmdstan-2.31.0.tar.gz from GitHub...
* Removing the existing installation of CmdStan...
* Download complete
* Unpacking archive...
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file 'C:\Users\damon\Documents/.cmdstan/cmdstan-2.31.0/make/local': No such file or directory

I have RTools42 installed and have gone to my control panel to set my system path variable to include: C:\rtools42\usr\bin and C:\rtools42\mingw64\bin as discussed here. I also tried running an example model as suggested here, but recieve the following error:

> fit <- cmdstanr_example("logistic")
Compiling Stan program...
Error in `(function (command = NULL, args = character(), error_on_status = TRUE, …`:
! System command 'make' failed
---
Exit status: 2
Stderr:
make: *** No rule to make target 'print-STANCFLAGS'.  Stop.
---
Type .Last.error to see the more details.

I’ve also checked out this blog post that folks seem to reference, but still can’t seem to get things to work.

This has been challenging me all morning…

I guess I shouldn’t use renv to install cmdstanr. I just installed it on my system instead and it worked.

I am unable to install CMDstanR on my mac (latest versions of ios, R, RStudio, etc). I use: install.packages(“remotes”)
remotes::install_github(“stan-dev/cmdstanr”)

and get this:

Error in install.packages : Updating loaded packages
Downloading GitHub repo stan-dev/cmdstanr@HEAD
── R CMD build ──────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/private/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T/RtmpbhbN65/remotesace54a226ae/stan-dev-cmdstanr-ab30e07/DESCRIPTION’ …
─ preparing ‘cmdstanr’:
✔ checking DESCRIPTION meta-information …
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
Omitted ‘LazyData’ from DESCRIPTION
─ building ‘cmdstanr_0.5.3.tar.gz’

Error: 3:49: unexpected string constant
3: if (Sys.getenv(“RSTUDIO”) == “1” && RSTUDIO_TERM")) &&
4: Sys.info()["
^
Execution halted
Warning: installation of package ‘/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T//RtmpbhbN65/fileace619994ea/cmdstanr_0.5.3.tar.gz’ had non-zero exit status

Any ideas? Thanks.

I am unable to install CMDstanR on my mac (latest versions of ios, R, RStudio, etc). I use: install.packages("remotes")
remotes::install_github("stan-dev/cmdstanr")

and get this:

Error in install.packages : Updating loaded packages
Downloading GitHub repo stan-dev/cmdstanr@HEAD
── R CMD build ──────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T/RtmpbhbN65/remotesace54a226ae/stan-dev-cmdstanr-ab30e07/DESCRIPTION’ ...
─  preparing ‘cmdstanr’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted ‘LazyData’ from DESCRIPTION
─  building ‘cmdstanr_0.5.3.tar.gz’
   
Error: 3:49: unexpected string constant
3: if (Sys.getenv("RSTUDIO") == "1" && RSTUDIO_TERM")) &&
4:     Sys.info()["
                                                   ^
Execution halted
Warning: installation of package ‘/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T//RtmpbhbN65/fileace619994ea/cmdstanr_0.5.3.tar.gz’ had non-zero exit status

Any ideas? Thanks.

If possible, add also code to simulate data or attach a (subset of) the dataset you work with.

Don’t forget to add relevant tags to your topic (top right of this form) especially for application area. Delete this text before posting your question :-) Thx!

If your question relates to installation please provide the following information:

  • Operating System
  • RStan Version
  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
  • Output of devtools::session_info("rstan")

If you are reporting a bug (thank you!) please use the issue tracker (Issues · stan-dev/rstan · GitHub) instead of the forums.

Looking forward to your topic!