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!

I am having this issue but that page is currently down. Is there another place I could find these issues?

@JMalnight yeah that link seems to be broken now. As an alternative, @rok_cesnovar made a branch of CmdStanR on GitHub that is intended to help resolve some Windows installation problems. It hasn’t been merged into the main branch of CmdStanR yet but I think it’s functional so you could try it out. To install CmdStanR from that branch you can do:

install_github("stan-dev/cmdstanr", ref = "windows_fixes") 

Then you can load the package and try running install_cmdstan() again. Hopefully that will get it installed successfully but if not definitely let us know and we’ll help troubleshoot further.

1 Like

Hi. I came across the same problem. I use Windows 10 with RStudio and Rtools4.0. During the cmdstan installation this message pops out:
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin, :
Command ‘mingw32-make.exe’ not found @win/processx.c:994 (processx_exec)
I have tried to manually install mingw32-make.exe (based on the tutorial here: https://genome.sph.umich.edu/wiki/Installing_MinGW_%26_MSYS_on_Windows)
but it did not help. The page with the most compehensible cmdstan installation instructions for Windows is down and the devtools::install_github(“stan-dev/cmdstanr”, ref = “windows_fixes”) redirects me to URL https://api.github.com/repos/stan-dev/cmdstanr/tarball/windows_fixes, that apparently does not exist. Can you help me?

Hey @esoturda,

I would advise you or anyone reading this topic at any time in the future to upgrade to the latest cmdstanr version. Currently that is available with

remotes::install_github("stan-dev/cmdstanr")

but will soon also be available at the R package repository.

You can use check_cmdstan_toolchain() to check whether your toolchain is setup correctly. You can also run check_cmdstan_toolchain(fix = TRUE) to fix any issue that can be fixed automatically within R.

3 Likes

Amazing! This worked. Everything was fixed with this: check_cmdstan_toolchain(fix = TRUE) I feel like a fool. Thank you <3

2 Likes

Don’t feel like a fool! This stuff is annoying as hell and we haven’t really publicized this option yet, as its only available on the Github version. Glad it helped! Enjoy!

2 Likes