Description
I am assisting a client installing cmdstan and cmdstanr on a Windows 11 machine. I have tried various strategies for installing CmdStan, none of which have been successful. We've tried the standard procedure of using cmdstanr::install_cmdstan()
as well as installing cmdstan via Anaconda, and setting cmdstan path to the instance of cmdstan installed by Anaconda. When using install_cmdstan()
, it verifies that the toolchain is set up properly, and Rtools appears as expected in the PATH variable.
Unfortunately both ways of installing lead to the same error message when we try to run a model: mingw32-make Error 1 in model_header.hpp.gch. Below is a representative console + error log when we try to run a brms model with cmdstanr backend.
By the way I also tried running install_cmdstan
with PRECOMPILED_HEADERS=FALSE but that did not seem to solve the problem either.
OS is Windows 11 running R 4.4.1 and installing latest stable versions of CmdStan and CmdStanR.
Console & error log:
> cmdstanr::set_cmdstan_path("C:/Users/Kip.Balkcom/AppData/Local/anaconda3/Library/bin/cmdstan")
CmdStan path set to: C:/Users/Kip.Balkcom/AppData/Local/anaconda3/Library/bin/cmdstan
> library(brms)
Loading required package: Rcpp
Loading 'brms' package (version 2.22.0). Useful instructions
can be found by typing help('brms'). A more detailed introduction
to the package is available through vignette('brms_overview').
Attaching package: ‘brms’
The following object is masked from ‘package:stats’:
ar
Warning message:
package ‘brms’ was built under R version 4.4.2
> options(mc.cores = 4, brms.backend = 'cmdstanr', brms.file_refit = 'on_change')
> brm(mpg~hp, data = mtcars)
Compiling Stan program...
mingw32-make: *** [make/program:28: stan/src/stan/model/model_header.hpp.gch/model_header_14_2.hpp.gch] Error 1
Error: An error occured during compilation! See the message above for more information.
In addition: Warning message:
CmdStan's precompiled header (PCH) files may need to be rebuilt.
If your model failed to compile please run rebuild_cmdstan().
If the issue persists please open a bug report.
>