Can't run pystan on WIndows

I have been following the instructions on pystan’s website here to install pystan on windows 10. I follow the instructions line by line - I set up a new environment, install mingw-w64 compiler toolchain, add a .cfg file to the folder as instructed, install dependencies and finally pystan.

When I run the sample model as instructed python gives this error:

Blockquote
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.
Traceback (most recent call last):
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\unixccompiler.py”, line 267, in link
self.spawn(linker + ld_args)
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\ccompiler.py”, line 987, in spawn
spawn(cmd, dry_run=self.dry_run, **kwargs)
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\spawn.py”, line 70, in spawn
raise DistutilsExecError(
distutils.errors.DistutilsExecError: command ‘C:\Users\xxx\anaconda3\Library\mingw-w64\bin\g++.exe’ failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\xxx\anaconda3\lib\site-packages\pystan\model.py”, line 378, in init
build_extension.run()
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 346, in run
self.build_extensions()
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 466, in build_extensions
self._build_extensions_serial()
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 492, in _build_extensions_serial
self.build_extension(ext)
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 571, in build_extension
self.compiler.link_shared_object(
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\ccompiler.py”, line 751, in link_shared_object
self.link(
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\cygwinccompiler.py”, line 260, in link
UnixCCompiler.link(
File “C:\Users\xxx\anaconda3\lib\site-packages\setuptools_distutils\unixccompiler.py”, line 269, in link
raise LinkError(msg)
distutils.errors.LinkError: command ‘C:\Users\xxx\anaconda3\Library\mingw-w64\bin\g++.exe’ failed with exit code 1

I have checked the forum for similar issues. Following their advice I double checked on the .cfg file and it is in the correct folder with the content as instructed by the website. The issue persists.
I suspect the problem is related to c++ compiler but I don’t know where to go from here. Please help!

These GCC mingw errors are hard and pystan is not tested with the latest python versions.

Have you tried CmdStanPy (+ArviZ)