Error installing CmdStan (Windows 10; Command 'mingw32-make.exe' not found @win/processx.c:983)

I’m following the install instructions here: https://mc-stan.org/cmdstanr/articles/cmdstanr.html

> install_cmdstan(cores = 2)
* Latest CmdStan release is v2.23.0
* Installing CmdStan v2.23.0 in C:\Users\vuorr\Documents/.cmdstanr/cmdstan-2.23.0
* Downloading cmdstan-2.23.0.tar.gz from GitHub...
* Download complete
* Unpacking archive...
* Building CmdStan binaries...
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin,  : 
  Command 'mingw32-make.exe' not found @win/processx.c:983 (processx_exec)
Type .Last.error.trace to see where the error occured

For what its worth:

> .Last.error.trace

 Stack trace:

 1. cmdstanr:::install_cmdstan(cores = 2)
 2. cmdstanr:::build_cmdstan(dir_cmdstan, cores, quiet, timeout)
 3. processx::run(make_cmd(), args = c(paste0("-j", cores), "build"),  ...
 4. process$new(command, args, echo_cmd = echo_cmd, wd = wd, windows_verbatim_args = windows_verbatim_args,  ...
 5. .subset2(public_bind_env, "initialize")(...)
 6. processx:::process_initialize(self, private, command, args, stdin,  ...
 7. rethrow_call(c_processx_exec, command, c(command, args), stdin,  ...

 x Command 'mingw32-make.exe' not found @win/processx.c:983 (processx_exec) 

I also tried without the cores argument.

Operating System: Windows 10
Interface Version: cmdstanr 2.23.0
Compiler/Toolkit: Rtools40

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] bayesplot_1.7.2     posterior_0.1.0     cmdstanr_0.0.0.9008

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6     rstudioapi_0.11  knitr_1.29       magrittr_1.5     tidyselect_1.1.0 munsell_0.5.0   
 [7] colorspace_1.4-1 R6_2.4.1         rlang_0.4.6      plyr_1.8.6       dplyr_1.0.0      tools_4.0.2     
[13] grid_4.0.2       packrat_0.5.0    checkmate_2.0.0  gtable_0.3.0     xfun_0.15        htmltools_0.5.0 
[19] ellipsis_0.3.1   abind_1.4-5      yaml_2.2.1       digest_0.6.25    tibble_3.0.1     lifecycle_0.2.0 
[25] crayon_1.3.4     processx_3.4.2   purrr_0.3.4      ggplot2_3.3.2    ps_1.3.3         ggridges_0.5.2  
[31] vctrs_0.3.1      glue_1.4.1       evaluate_0.14    rmarkdown_2.3    compiler_4.0.2   pillar_1.4.4    
[37] generics_0.0.2   scales_1.1.1     backports_1.1.8  jsonlite_1.7.0   pkgconfig_2.0.3 

Did you manually install mingw32-make?

See https://github.com/stan-dev/cmdstanpy/blob/da306ec14dcdf4bb36886a47206cf1a5dfeaa19b/cmdstanpy/install_cxx_toolchain.py#L120

pacman -Sy mingw-w64-x86_64-make

Thanks @ahartikainen, I succesfully ran that line of code in the RTools bash shell. However, I then tried again to install CmdStan as above but failed with the same error. Is mingw32-make different to mingw64 mingw-w64-x86_64-make 4.2.1-2 [installed] as installed by the code snippet you pasted?

Please take a look here: https://www.maxmantei.com/blog/2020-05-16-installing-cmdstanr-on-windows/cmdstanr-windows/

These are the most complete instruction for Windows right now. Its for cmdstanR but the first parts are the same regardless of whether you are using cmdstan or cmdstanr.

3 Likes

Thanks, I’ll give that a shot! (I ended up using RStudio server thru WSL as per your previous link: https://medium.com/lead-and-paper/how-to-use-rstudio-server-for-ubuntu-on-windows-10-a7aeee661a5d)

3 Likes

This is actually what I’d suggest as well :)

2 Likes

This is a great blog post. Thanks @Max_Mantei. @rok_cesnovar maybe we should link to these instructions from the CmdStanR documentation. What do you think?

1 Like

Yes! I also have permission from Max to re-use this for the eventual official Stan instructions.

I’ll only be at my computer occasionally this week (I’m in the process of moving) but feel free to add that somewhere in the CmdStanR doc. Maybe in the install_cmdstan() doc and possibly a link in the vignette near where we show how to run install_cmdstan().

Will do. Safe travels!