Cmdstan installation on windows


As suggested in I have cloned cmdstan using

git clone --recursive

and then make build.
I am using rtools 3.5 and my path contains

So far so good but after a while I got a message:
C:\Rtools\mingw_64\bin\ar.exe: creating stan/lib/stan_math/lib/sundials_4.1.0/lib/libsundials_kinsol.a
ERROR: Please use mingw32-make on Windows to build the Intel TBB library.

Is some additional configuration necessary?

Thanks for any advice.

PS. I have installed rtools3.4 and latest cmdstan tarball. Amazingly it builds.

Instead of make use mingw32-make.


Does this mean run this command:

mingw32-make build

instead of:

make build


That is correct.

Thanks but unfortunately I’m getting the error:

‘mingw32-make’ is not recognised as an internal or external command

I’ve been following the cmdstan installation instructions here ( but notice a few differences:

  1. The directory RTools has installed to seems to be C:\RBuildTools\4.0\ and not C:\RTools\RTools40\. I have therefore adjusted the directories listed in PATH accordingly to:
  • C:\RBuildTools\4.0\mingw64\bin and

  • C:\RBuildTools\4.0\usr\bin

Is this ok?

  1. Neither of the two directories above contain a mingw32-make.exe file. Only the usr\bin directory contains a make.exe file. Also when I run command mingw32-make --version I’m getting the same ‘not recognised’ error. If I run make --version I get:

GNU Make 4.2.1
Built for x86_64-pc-msys
Copyright © 1988-2016 Free Software Foundation, Inc.

What else should I try in order to get the make build command to run without errors?

Yes, that is correct.


pacman -Sy mingw-w64-x86_64-make

In your powershell and then restart the shell. You should have mingw32-make then.

1 Like

That worked, thank you.

thanks to everyone on this thread - I’ve opened a docs issue to track these discussions so that we can keep the docs and CmdStan wiki up-to-date.


I’m somewhat late to the party here, but I’m getting exactly this issue. The proposed solutions don’t satisfy me becaase:
a - they don’t work for me
b - I’ve already installed RTools, msys, and gcc in all its bloated horror, and already have 32 and 64 bit versions of mingw make. Is the Intell tlb make looking for make.exe under a different alias? And why mingw32? Does it only build as a 32 bit library?

Also, while I’m here - what is the function of the Intel TBB library in this context?

Following is bash output with the error I get:

$ make build
INFO: Could not find files for the given pattern(s).
if ! [[ make =~ mingw32 ]]; then
echo “ERROR: Please use mingw32-make on Windows to build the Intel TBB library.”;
echo “This is packaged with RTools, for example.”;
exit 1;
ERROR: Please use mingw32-make on Windows to build the Intel TBB library.
This is packaged with RTools, for example.
make: *** [stan/lib/stan_math/make/libraries:153: stan/lib/stan_math/lib/tbb/tbb-make-check] Error 1

1 Like

You need to use mingw32-make build. TBB requires mingw32-make and that is why cmdstan also requires its use.

Its used for multithreading.

1 Like

Hi Rok

Thanks for your answer.

But, the point of my question, for Windows users, was to ask the difference between the make.exe downloaded as part of Rtools and the mingw32-make(exe?) required to build tbb. There is a certain amount of jibber-jabber on this new internet thing about how mingw32-make.exe is obsolete. And one of make or ming32-make does the job.

But, dunno. I’ve given building cmdstan on Windows my best shot. And I’ve failed. So PyMCMC3.

And. if my comments on this forum have been tetchy, I apologise. But, personally - I’ve made a living out of computer programming for 40+ years, and I find the process of getting cmdstan to install on my insanely powerful, by the standards of my youth, computer insanely infuriating. In my case, because I want to follow along with books by McElreath and Lambert, they say all you have to do is install STAN. Whacko, good luck with that.

Hi, did you try installation with CmdStanPy

mingw32-make is actually 64bit make and has some extra properties that the default make probably don’t have.

I usually do this (in cmd.exe)

pip install cmdstanpy
python -m cmdstanpy.install_cxx_toolchain
python -m cmdstanpy.install_cmdstan --compiler

And then in Python script I do this to add compiler to the PATH

from cmdstanpy.utils import cxx_toolchain_path

this is valuable feedback - and I mean this most sincerely. I fear that many others have done the same, but we have no way of figuring out how many more people would use Stan if it weren’t for installation woes.

thanks to Ari, CmdStanPy does address the CXX toolchain problems on Windows - it’s worth a try, and if it doesn’t work, please file an issue.

For what it’s worth I had no difficulty at all building cmdstan with threading support in Windows and adapting my own R code to use cmdstanr instead of Rstan, and I’m just an ordinary user and strictly recreational programmer.

Up to date and complete documentation of the installation process would be a big help. I got at least one important piece of information from a blog post by @Max_Mantei that seems to have disappeared unfortunately (the necessary hint about using pacman to install mingw32-make.exe is upthread somewhere).

Confusingly enough, mingw32-make builds for 64 bit architecture.

1 Like

this is indeed 404 -

Edit by @Max_Mantei: Fixed the website… new link:

Thanks for the helpful response. I’ll give it ago. Apologies again for being tetchy. Note to self: do not post when in a bad mood. Stan is obviously a hugely powerful piece of software, and I regret sounding negative. I’d like to get it running under Windows. I have now got it going on a Mac with no issues, so at least I can follow the books. I’d still like to run under Windows as well, and will give it another crack.

1 Like