# \#python

**URL:** https://discourse.mc-stan.org/tag/python/166.md

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

---

## [Brmspy: Python-first access to brms (cmdstanr backend, ArviZ output)](https://discourse.mc-stan.org/t/brmspy-python-first-access-to-brms-cmdstanr-backend-arviz-output/40685)

<div class="topic-metadata">

**Author:** [@Braffolk](https://discourse.mc-stan.org/u/Braffolk)\
**Replies:** 10\
**Last updated:** [March 27, 2026, 1:27pm UTC](https://discourse.mc-stan.org/t/brmspy-python-first-access-to-brms-cmdstanr-backend-arviz-output/40685 "2026-03-27T13:27:52Z")

</div>

Hi all. I wanted to share a Python interface I’ve been building for brms that may be useful for anyone who works across both R and Python environments. brmspy provides a Python-side API for fitting brms models via cmdst…

---

## [Apple Silicon wheels for PyStan / httpstan available, testing welcome](https://discourse.mc-stan.org/t/apple-silicon-wheels-for-pystan-httpstan-available-testing-welcome/40645)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [November 14, 2025, 4:04pm UTC](https://discourse.mc-stan.org/t/apple-silicon-wheels-for-pystan-httpstan-available-testing-welcome/40645 "2025-11-14T16:04:03Z")

</div>

Apple Silicon/ARM64 users should be able to install PyStan with pip now. I don’t have a macOS machine so I can’t verify that it works. If it doesn’t work, I can pull the wheels. There are also now Python 3.14 wheels for…

---

## [Comparision: simple AR(1) model in stan vs. pymc](https://discourse.mc-stan.org/t/comparision-simple-ar-1-model-in-stan-vs-pymc/37529)

<div class="topic-metadata">

**Author:** [@teagum](https://discourse.mc-stan.org/u/teagum)\
**Replies:** 4\
**Last updated:** [December 10, 2024, 9:10pm UTC](https://discourse.mc-stan.org/t/comparision-simple-ar-1-model-in-stan-vs-pymc/37529 "2024-12-10T21:10:17Z")

</div>

I’am trying to replicate an AR model I once code in PyMC. Th Stan version gives yield some different results and would like to know why this is the case. This is the PyMC code: with pm.Model() as pm\_model: rho = pm…

---

## [How to use a fitted stan model for production (get posterior predictive distributions) in python](https://discourse.mc-stan.org/t/how-to-use-a-fitted-stan-model-for-production-get-posterior-predictive-distributions-in-python/36842)

<div class="topic-metadata">

**Author:** [@saya](https://discourse.mc-stan.org/u/saya)\
**Replies:** 1\
**Last updated:** [October 14, 2024, 7:21pm UTC](https://discourse.mc-stan.org/t/how-to-use-a-fitted-stan-model-for-production-get-posterior-predictive-distributions-in-python/36842 "2024-10-14T19:21:26Z")

</div>

Using fitted stan model with rstan for production in python Hello, I am pretty new to stan, I have fitted a model which I coded in stan with rstan, in this model I have already used generated quantities in the stan cod…

---

## [PyStan 3.10 (Stan 2.35.0) released](https://discourse.mc-stan.org/t/pystan-3-10-stan-2-35-0-released/35746)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [July 3, 2024, 5:11pm UTC](https://discourse.mc-stan.org/t/pystan-3-10-stan-2-35-0-released/35746 "2024-07-03T17:11:05Z")

</div>

PyStan 3.10 is available on PyPI. This release features the newest version of Stan, version 2.35.0. Documentation: https://pystan.readthedocs.io Source code: https://github.com/stan-dev/pystan

---

## [Converting sccomp from rstan to Python - paid work + addendum authorsphip on the paper](https://discourse.mc-stan.org/t/converting-sccomp-from-rstan-to-python-paid-work-addendum-authorsphip-on-the-paper/33743)

<div class="topic-metadata">

**Author:** [@stemangiola](https://discourse.mc-stan.org/u/stemangiola)\
**Replies:** 12\
**Last updated:** [June 6, 2024, 8:05am UTC](https://discourse.mc-stan.org/t/converting-sccomp-from-rstan-to-python-paid-work-addendum-authorsphip-on-the-paper/33743 "2024-06-06T08:05:34Z")

</div>

Hello All, I would like to convert sccomp https://www.pnas.org/doi/10.1073/pnas.2203828120 GitHub - MangiolaLaboratory/sccomp: Testing differences in cell type proportions from single-cell data. from rstan to pystan,…

---

## [Bibat: batteries-included Bayesian analysis template](https://discourse.mc-stan.org/t/bibat-batteries-included-bayesian-analysis-template/34312)

<div class="topic-metadata">

**Author:** [@Teddy\_Groves1](https://discourse.mc-stan.org/u/Teddy_Groves1)\
**Replies:** 2\
**Last updated:** [March 8, 2024, 1:13pm UTC](https://discourse.mc-stan.org/t/bibat-batteries-included-bayesian-analysis-template/34312 "2024-03-08T13:13:42Z")

</div>

I’ve been working for a while on a template for Python-based Bayesian workflow projects. I discussed a previous version here and presented a more up to date one at the last Stancon, but there have been a few more changes…

---

## [PyStan 3.9 (Stan 2.34.1) released](https://discourse.mc-stan.org/t/pystan-3-9-stan-2-34-1-released/34057)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [February 7, 2024, 2:51pm UTC](https://discourse.mc-stan.org/t/pystan-3-9-stan-2-34-1-released/34057 "2024-02-07T14:51:31Z")

</div>

PyStan 3.9 is available on PyPI. This release features the newest version of Stan, version 2.34.1. Documentation: https://pystan.readthedocs.io Source code: https://github.com/stan-dev/pystan

---

## [PyStan 3.8 (Stan 2.33.0) released](https://discourse.mc-stan.org/t/pystan-3-8-stan-2-33-0-released/33583)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [December 14, 2023, 2:55pm UTC](https://discourse.mc-stan.org/t/pystan-3-8-stan-2-33-0-released/33583 "2023-12-14T14:55:19Z")

</div>

PyStan 3.8 is available on PyPI. This release features the newest version of Stan, version 2.33.0. Documentation: https://pystan.readthedocs.io Source code: https://github.com/stan-dev/pystan Additional notes: Help …

---

## [Python integration for Stan (in the style of R's ulam)](https://discourse.mc-stan.org/t/python-integration-for-stan-in-the-style-of-rs-ulam/33310)

<div class="topic-metadata">

**Author:** [@tmbb](https://discourse.mc-stan.org/u/tmbb)\
**Replies:** 9\
**Last updated:** [November 30, 2023, 1:13pm UTC](https://discourse.mc-stan.org/t/python-integration-for-stan-in-the-style-of-rs-ulam/33310 "2023-11-30T13:13:17Z")

</div>

I’ve been quite impressed by the ulam R package which is used in the (excelent) Rethinking Statistics online lectures. However, I don’t like R very much, and as a result I usually end up using python and write models dir…

---

## [Creating a MCMC sampler based on the emcee python import](https://discourse.mc-stan.org/t/creating-a-mcmc-sampler-based-on-the-emcee-python-import/32398)

<div class="topic-metadata">

**Author:** [@Daniel-Rogo](https://discourse.mc-stan.org/u/Daniel-Rogo)\
**Replies:** 3\
**Last updated:** [September 6, 2023, 12:34pm UTC](https://discourse.mc-stan.org/t/creating-a-mcmc-sampler-based-on-the-emcee-python-import/32398 "2023-09-06T12:34:25Z")

</div>

Hello everyone, I am currently working on pystan 3.7, and I am trying to create a Monte Carlo model function in Stan that imitates or does the same thing as the python import emcee function, EnsembleSampler ( and Sample…

---

## [Problems with posteriors of parameters in Bayesian hierarchical model (cmdstanpy)](https://discourse.mc-stan.org/t/problems-with-posteriors-of-parameters-in-bayesian-hierarchical-model-cmdstanpy/32376)

<div class="topic-metadata">

**Author:** [@Simon\_Smith](https://discourse.mc-stan.org/u/Simon_Smith)\
**Replies:** 1\
**Last updated:** [August 22, 2023, 3:23pm UTC](https://discourse.mc-stan.org/t/problems-with-posteriors-of-parameters-in-bayesian-hierarchical-model-cmdstanpy/32376 "2023-08-22T15:23:51Z")

</div>

Hi there, I’m having a problem getting the modes of my posterior probability distributions lining up to what I’d expect them to be, given the data I am learning from. I am using the package cmdstanpy. I have a generate…

---

## [PyStan 3.7 (Stan 2.32.0) released](https://discourse.mc-stan.org/t/pystan-3-7-stan-2-32-0-released/31170)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [April 23, 2023, 7:47pm UTC](https://discourse.mc-stan.org/t/pystan-3-7-stan-2-32-0-released/31170 "2023-04-23T19:47:43Z")

</div>

PyStan 3.7 is available on PyPI. This release features the newest version of Stan, version 2.32.0. Documentation: https://pystan.readthedocs.io Source code: https://github.com/stan-dev/pystan

---

## [Pystan3 Not compiling with conda version of clang on mac os (can't find header files)](https://discourse.mc-stan.org/t/pystan3-not-compiling-with-conda-version-of-clang-on-mac-os-cant-find-header-files/30719)

<div class="topic-metadata">

**Author:** [@chester](https://discourse.mc-stan.org/u/chester)\
**Replies:** 1\
**Last updated:** [March 14, 2023, 12:30pm UTC](https://discourse.mc-stan.org/t/pystan3-not-compiling-with-conda-version-of-clang-on-mac-os-cant-find-header-files/30719 "2023-03-14T12:30:42Z")

</div>

I am trying to run the following simple code to test out my pystan installation: import pystan fit = pystan.StanModel(model\_code="parameters {real theta;} model {theta ~ normal(0,1);}", model\_name="model\_name") I get t…

---

## [Exposing Stan functions in Python via PyBind](https://discourse.mc-stan.org/t/exposing-stan-functions-in-python-via-pybind/28830)

<div class="topic-metadata">

**Author:** [@WardBrian](https://discourse.mc-stan.org/u/WardBrian)\
**Replies:** 5\
**Last updated:** [February 28, 2023, 9:02pm UTC](https://discourse.mc-stan.org/t/exposing-stan-functions-in-python-via-pybind/28830 "2023-02-28T21:02:33Z")

</div>

Hi all - I’ve recently done some experimenting in how to expose functions written in a Stan model to Python. I’ve cleaned up the results of these and put them up here: GitHub - WardBrian/pybind\_expose\_stan\_fns: Exposing…

---

## [Calling mac M1 users to try pip-installable httpstan branch](https://discourse.mc-stan.org/t/calling-mac-m1-users-to-try-pip-installable-httpstan-branch/25245)

<div class="topic-metadata">

**Author:** [@tillahoffmann](https://discourse.mc-stan.org/u/tillahoffmann)\
**Replies:** 6\
**Last updated:** [December 1, 2022, 12:21pm UTC](https://discourse.mc-stan.org/t/calling-mac-m1-users-to-try-pip-installable-httpstan-branch/25245 "2022-12-01T12:21:31Z")

</div>

@ariddell and I discussed making httpstan pip installable from source. This should allow M1 users (and more generally any architecture for which pre-compiled wheels do not exist) to use httpstan (which is required for th…

---

## [PyStan 3.6 (Stan 2.31) is now available](https://discourse.mc-stan.org/t/pystan-3-6-stan-2-31-is-now-available/29612)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [November 26, 2022, 2:25pm UTC](https://discourse.mc-stan.org/t/pystan-3-6-stan-2-31-is-now-available/29612 "2022-11-26T14:25:43Z")

</div>

PyStan 3.6 is available on PyPI. This release features the newest version of Stan, version 2.31. Documentation: https://pystan.readthedocs.io Source code: https://github.com/stan-dev/pystan

---

## [PC prior for P-Splines (in python)](https://discourse.mc-stan.org/t/pc-prior-for-p-splines-in-python/29438)

<div class="topic-metadata">

**Author:** [@jbaranowski](https://discourse.mc-stan.org/u/jbaranowski)\
**Replies:** 2\
**Last updated:** [November 11, 2022, 5:05pm UTC](https://discourse.mc-stan.org/t/pc-prior-for-p-splines-in-python/29438 "2022-11-11T17:05:39Z")

</div>

I’m trying to implement P-splines with PC prior in stan and results are less than stellar. In particular: The E-BFMI, 0.00, is below the nominal threshold of 0.30 which suggests that HMC may have trouble exploring the …

---

## [PyStan 3.5 (Stan 2.30) is now available](https://discourse.mc-stan.org/t/pystan-3-5-stan-2-30-is-now-available/28087)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [July 5, 2022, 6:07pm UTC](https://discourse.mc-stan.org/t/pystan-3-5-stan-2-30-is-now-available/28087 "2022-07-05T18:07:49Z")

</div>

PyStan 3.5 is available on PyPI. This release features the newest version of Stan, version 2.30. Documentation: https://pystan.readthedocs.io Source code: https://github.com/stan-dev/pystan

---

## [Differences in Stan code between Pystan and ArviZ tutorials](https://discourse.mc-stan.org/t/differences-in-stan-code-between-pystan-and-arviz-tutorials/27666)

<div class="topic-metadata">

**Author:** [@gimi](https://discourse.mc-stan.org/u/gimi)\
**Replies:** 1\
**Last updated:** [May 30, 2022, 10:56pm UTC](https://discourse.mc-stan.org/t/differences-in-stan-code-between-pystan-and-arviz-tutorials/27666 "2022-05-30T22:56:01Z")

</div>

I am an absolute beginner in Stan, and I was looking at the “eight schools” example that is referenced in both the Pystan and the ArviZ “getting started” pages. I noticed that they implement the same model in different w…

---

## [PyStan 3.4 is released](https://discourse.mc-stan.org/t/pystan-3-4-is-released/26371)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [February 15, 2022, 10:39pm UTC](https://discourse.mc-stan.org/t/pystan-3-4-is-released/26371 "2022-02-15T22:39:21Z")

</div>

PyStan 3.4 is available on PyPI. This release features the newest version of Stan, version 2.29. Documentation: https://pystan.readthedocs.io Source code: https://github.com/stan-dev/pystan

---

## [Timeout error during pystan build](https://discourse.mc-stan.org/t/timeout-error-during-pystan-build/24025)

<div class="topic-metadata">

**Author:** [@Aditya\_Goyal](https://discourse.mc-stan.org/u/Aditya_Goyal)\
**Replies:** 2\
**Last updated:** [February 14, 2022, 9:36am UTC](https://discourse.mc-stan.org/t/timeout-error-during-pystan-build/24025 "2022-02-14T09:36:35Z")

</div>

I am trying to run pystan 3.2 on our new python docker container. Python version == 3.8.8. I ran the code below and I keep getting a timeout error during the stan.build portion of the code. I used the FAQ to figure out …

---

## [Identification problems: Unable to recover parameters in Multinomial IRT](https://discourse.mc-stan.org/t/identification-problems-unable-to-recover-parameters-in-multinomial-irt/25406)

<div class="topic-metadata">

**Author:** [@ZMV](https://discourse.mc-stan.org/u/ZMV)\
**Replies:** 4\
**Last updated:** [November 29, 2021, 9:59am UTC](https://discourse.mc-stan.org/t/identification-problems-unable-to-recover-parameters-in-multinomial-irt/25406 "2021-11-29T09:59:43Z")

</div>

I am trying to estimate the following multinomial IRT model: \\left\[ y\_{i1} \\dots y\_{iJ} \\right\] \\sim Multinomial(\\pi\_{i1} \\dots \\pi\_{iJ}, y\_{i+}) where y\_{ij} are the counts of word j in document i and y\_{i+} is the t…

---

## [Proposal: add method to get samples grouped by chain from pystan interface](https://discourse.mc-stan.org/t/proposal-add-method-to-get-samples-grouped-by-chain-from-pystan-interface/25016)

<div class="topic-metadata">

**Author:** [@tillahoffmann](https://discourse.mc-stan.org/u/tillahoffmann)\
**Replies:** 6\
**Last updated:** [November 2, 2021, 12:35pm UTC](https://discourse.mc-stan.org/t/proposal-add-method-to-get-samples-grouped-by-chain-from-pystan-interface/25016 "2021-11-02T12:35:00Z")

</div>

It is often convenient to be able to get samples grouped by the chain they came from (e.g. to identify whether different chains have found different modes of the posterior or to evaluate Rhat). @ariddell pointed me to th…

---

## [PyStan 3.3 is released](https://discourse.mc-stan.org/t/pystan-3-3-is-released/24727)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [October 6, 2021, 10:07am UTC](https://discourse.mc-stan.org/t/pystan-3-3-is-released/24727 "2021-10-06T10:07:30Z")

</div>

PyStan 3.3 is available on PyPI. This release features the newest version of Stan, version 2.28. Documentation: https://pystan.readthedocs.io Source code: https://github.com/stan-dev/pystan

---

## [PyStan 3.0 is released](https://discourse.mc-stan.org/t/pystan-3-0-is-released/21500)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 6\
**Last updated:** [September 12, 2021, 8:29pm UTC](https://discourse.mc-stan.org/t/pystan-3-0-is-released/21500 "2021-09-12T20:29:00Z")

</div>

The PyStan developers are happy to announce the release of PyStan 3.0. You can install PyStan from PyPI. PyStan 3 makes numerous backwards-incompatible changes and requires Python 3.7 or higher running on Linux or macOS…

---

## [MLE and "optimize" in PyStan3](https://discourse.mc-stan.org/t/mle-and-optimize-in-pystan3/24023)

<div class="topic-metadata">

**Author:** [@justin](https://discourse.mc-stan.org/u/justin)\
**Replies:** 2\
**Last updated:** [August 20, 2021, 12:40pm UTC](https://discourse.mc-stan.org/t/mle-and-optimize-in-pystan3/24023 "2021-08-20T12:40:30Z")

</div>

Hey PyStan Team, My team is still on PyStan 2.x and we often use the model.optimize() function to find a point estimate using MLE. I don’t see an equivalent function in PyStan3, was this left out intentionally? I under…

---

## [Posterior predictive plot in when using PyStan](https://discourse.mc-stan.org/t/posterior-predictive-plot-in-when-using-pystan/22847)

<div class="topic-metadata">

**Author:** [@ants007](https://discourse.mc-stan.org/u/ants007)\
**Replies:** 4\
**Last updated:** [June 4, 2021, 12:02pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-plot-in-when-using-pystan/22847 "2021-06-04T12:02:19Z")

</div>

Hello all, I just need you assistance with using PyStan ( I am bit new to python) While running a regression in stan , at the end I have a code : generated quantities { vector\[T\] y\_predict; for (t in 1:T) { y\_predic…

---

## [PyStan 3.1 is released](https://discourse.mc-stan.org/t/pystan-3-1-is-released/22843)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 0\
**Last updated:** [June 3, 2021, 5:16pm UTC](https://discourse.mc-stan.org/t/pystan-3-1-is-released/22843 "2021-06-03T17:16:04Z")

</div>

PyStan 3.1 is available on PyPI. This release features the newest version of Stan, version 2.27. For those of you new to PyStan 3, I encourage you to check out the detailed 3.0 release announcement, PyStan 3.0 is relea…

---

## [Zero-length array inputs in pystan 3.1.1](https://discourse.mc-stan.org/t/zero-length-array-inputs-in-pystan-3-1-1/22690)

<div class="topic-metadata">

**Author:** [@adaly](https://discourse.mc-stan.org/u/adaly)\
**Replies:** 2\
**Last updated:** [May 25, 2021, 6:37pm UTC](https://discourse.mc-stan.org/t/zero-length-array-inputs-in-pystan-3-1-1/22690 "2021-05-25T18:37:18Z")

</div>

After upgrading to pystan 3, I noticed that I am no longer able to run a number of older models containing vectors in the data block that may be length 0. For instance, in older versions of pystan (2.19.0.0), I might dec…

[Next page](https://discourse.mc-stan.org/tag/python/166.md?match_all_tags=true&page=1&tags%5B%5D=python)
