Skip to content

Instantly share code, notes, and snippets.

@tommylees112
Last active April 12, 2022 13:04
Show Gist options
  • Save tommylees112/5ac7a4973d57147c2b8f5fda477b929c to your computer and use it in GitHub Desktop.
Save tommylees112/5ac7a4973d57147c2b8f5fda477b929c to your computer and use it in GitHub Desktop.
New Pystan Environment that works on M1 Mac
conda create -n stan --yes
conda activate stan
conda install pip --yes
# Install httpstan from source (this will take a while).
pip install -v git+https://github.com/tillahoffmann/httpstan@pip
# Install pystan.
pip install 'pystan>=3'
# Try a dummy program (this should report build and sampling progress).
python -c 'import stan; stan.build("parameters { real x; } model { x ~ normal(0, 1); }").sample()'
conda install -c conda-forge ipython arviz scikit-learn seaborn jupyterlab nest-asyncio --yes
# test https://pystan.readthedocs.io/en/latest/
@tommylees112
Copy link
Author

tommylees112 commented Apr 12, 2022

Initialisation Errors are caused by data not meeting the constraints: here

---------------------------------------------------------------------------
RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/thomas_lees112/miniconda3/envs/stan/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/home/thomas_lees112/miniconda3/envs/stan/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "stanfit4anon_model_4f4910bcf40488584c481cb91fedfe57_36726699539089669.pyx", line 371, in stanfit4anon_model_4f4910bcf40488584c481cb91fedfe57_36726699539089669._call_sampler_star
  File "stanfit4anon_model_4f4910bcf40488584c481cb91fedfe57_36726699539089669.pyx", line 404, in stanfit4anon_model_4f4910bcf40488584c481cb91fedfe57_36726699539089669._call_sampler
RuntimeError: Initialization failed.
"""

But there is a problem with empty int lists: Github Issue here

This was discussed Discourse here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment