I used new conda environment. But basic test on the same page does not work!
It gives me an error:
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.
Traceback (most recent call last):
File "C:\Users\xyz\Anaconda3\lib\site-packages\setuptools\_distutils\unixccompiler.py", line 267, in link
self.spawn(linker + ld_args)
File "C:\Users\xyz\Anaconda3\lib\site-packages\setuptools\_distutils\ccompiler.py", line 987, in spawn
spawn(cmd, dry_run=self.dry_run, **kwargs)
File "C:\Users\xyz\Anaconda3\lib\site-packages\setuptools\_distutils\spawn.py", line 70, in spawn
raise DistutilsExecError(
distutils.errors.DistutilsExecError: command 'C:\\Users\\xyz\\Anaconda3\\Library\\mingw-w64\\bin\\g++.exe' failed with exit code 1
so my question is: does pystan v.2.19.1.1 work on pure Windows 10 (not WSL)?
I’m not sure if there are any new gcc compilers for python that work. I think I asked about this a few years ago from the devs who created the mingw-w64 version and they were not interested having a new version. At the same time python (the main library) devs decided to go with msvc support only on windows and given that there is/was unresolved bug with templates that Stan libs hit we were starting to run out of options.
I can try tomorrow couple of options and let see if they work.
It has been sometime since I last tried to use mingw-w64 so maybe current python versions has something that breaks it.
But are the old libs using the lp calculation or do they only use sampling etc? Maybe you could hack the “system” by wrapping CmdStanPy functionality and save it in a file called pystan and then import it as “pystan” (or make it a package and install).
in legacy stack it is a point estimate even, I think it was dropped in stan version 3.
this method:
def optimizing(self, data=None, seed=None,
init='random', sample_file=None, algorithm=None,
verbose=False, as_vector=True, **kwargs):
"""Obtain a point estimate by maximizing the joint posterior.
Compilation throws: division by zero is not a constant-expression ok, probably something has changed in cython etc and things will fail. Probably using older cython versions with older python (3.7 etc) is the only solution.
old msg
Ok, I did some testing
I had an environment with mingw-w64 toolchain and libpython installed as in the instructions (I had this installed for another things).
Then to really use the mingw, you need to edit the following files
After this I was able to install pystan and the example model compiled and sampled nicely.
nope, I was too quick to write this, some error popped up, not sure what, will do some more debugging.
So what has changed is that Cython apparently wants to use setuptools/_distutils instead of the main distutils and things fails due to this.
There was small set of code that revealed this
from Cython.Build.Inline import Distribution
dist.find_config_files()
# ['C:\\Users\\username\\miniconda3\\envs\\stan\\lib\\site-packages\\setuptools\\_distutils\\distutils.cfg']