Timely releases. PyStan 3 releases tend to arrive 30 hours after Stan releases (n = 1).
Requirements:
macOS or Linux.
Python 3.7 or higher.
Upgrading to PyStan 3 from PyStan 2:
There are many backwards-incompatible changes in PyStan 3.0. Upgrading to Newer Releases summarizes the changes.
Known issues:
Only the recommended sampler (No-U-Turn Sampler) is currently supported.
Windows is not supported at this time.
Linux users with older operating systems may have problems using wheels from PyPI. Ubuntu 20.04 and Debian Bullseye should work. Users with an older version of GCC or Clang need to install httpstan from source before installing pystan.
I get an asyncio error when I try to run inside a Jupyter notebook – but it works fine from ipython3 on the console. I’m on macOS Catalina 10.5.7, Python 3.8 from python.org.
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-10-7b3b7768a627> in <module>
25 "sigma": [15, 10, 16, 11, 9, 11, 10, 18]}
26
---> 27 posterior = stan.build(schools_code, data=schools_data)
28 fit = posterior.sample(num_chains=4, num_samples=1000)
29 eta = fit["eta"] # array with shape (8, 4000)
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/stan/model.py in build(program_code, data, random_seed)
300
301 try:
--> 302 return asyncio.run(go())
303 except KeyboardInterrupt:
304 pass
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/runners.py in run(main, debug)
31 """
32 if events._get_running_loop() is not None:
---> 33 raise RuntimeError(
34 "asyncio.run() cannot be called from a running event loop")
35
RuntimeError: asyncio.run() cannot be called from a running event loop
Thanks/sorry for not finding it on my own — but it’s useful to have this here on the announcement page (and on readthdocs.io?). I suspect that a large fraction of potential users are also on Jupyter…
this seems to be working with jupyter but the spyder (version=4.2.1) gives the same asyinco error and when using the mentioned code before import stan in spyder it is giving the following error:
RuntimeError: Exception during call to services function: BrokenProcessPool('A process in the process pool was terminated abruptly while the future was running or pending.'), traceback: [' File "/opt/anaconda3/envs/stan3/lib/python3.8/asyncio/tasks.py", line 280, in __step\n result = coro.send(None)\n', ' File "/opt/anaconda3/envs/stan3/lib/python3.8/site-packages/httpstan/services_stub.py", line 150, in call\n future.result()\n', ' File "/opt/anaconda3/envs/stan3/lib/python3.8/asyncio/futures.py", line 178, in result\n raise self._exception\n', ' File "/opt/anaconda3/envs/stan3/lib/python3.8/asyncio/tasks.py", line 280, in __step\n result = coro.send(None)\n', ' File "/opt/anaconda3/envs/stan3/lib/python3.8/site-packages/httpstan/services_stub.py", line 150, in call\n future.result()\n', ' File "/opt/anaconda3/envs/stan3/lib/python3.8/asyncio/futures.py", line 178, in result\n raise self._exception\n', ' File "/opt/anaconda3/envs/stan3/lib/python3.8/asyncio/tasks.py", line 280, in __step\n result = coro.send(None)\n', ' File "/opt/anaconda3/envs/stan3/lib/python3.8/site-packages/httpstan/services_stub.py", line 150, in call\n future.result()\n', ' File "/opt/anaconda3/envs/stan3/lib/python3.8/asyncio/futures.py", line 178, in result\n raise self._exception\n']