# \#pystan

**URL:** https://discourse.mc-stan.org/tag/pystan/7.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)

---

## [On the usage of Pystan with other sampling libraries in python](https://discourse.mc-stan.org/t/on-the-usage-of-pystan-with-other-sampling-libraries-in-python/41539)

<div class="topic-metadata">

**Author:** [@dgsharp](https://discourse.mc-stan.org/u/dgsharp)\
**Replies:** 6\
**Last updated:** [August 21, 2026, 6:48pm UTC](https://discourse.mc-stan.org/t/on-the-usage-of-pystan-with-other-sampling-libraries-in-python/41539 "2026-08-21T18:48:26Z")

</div>

Hi! I was at StanCon this week and really appreciated all of the discourse and presentations. One thing that came up in a conversation with @WardBrian was the ability to benchmark other tools’ samplers with Stan-based mo…

---

## [Mixture, survival and ordinal models courses start in two weeks](https://discourse.mc-stan.org/t/mixture-survival-and-ordinal-models-courses-start-in-two-weeks/40056)

<div class="topic-metadata">

**Author:** [@lizzieinvancouver](https://discourse.mc-stan.org/u/lizzieinvancouver)\
**Replies:** 0\
**Last updated:** [August 3, 2025, 8:28pm UTC](https://discourse.mc-stan.org/t/mixture-survival-and-ordinal-models-courses-start-in-two-weeks/40056 "2025-08-03T20:28:43Z")

</div>

Hi all and happy post lammas day, Friendly (and probably final) reminder about upcoming online courses on mixture, survival and ordinal models and pairwise comparison modeling. Courses start 18 August and you can regist…

---

## [How to vectorize the stan code to reduce the run time](https://discourse.mc-stan.org/t/how-to-vectorize-the-stan-code-to-reduce-the-run-time/37554)

<div class="topic-metadata">

**Author:** [@Samip\_Tandon](https://discourse.mc-stan.org/u/Samip_Tandon)\
**Replies:** 7\
**Last updated:** [December 10, 2024, 9:42pm UTC](https://discourse.mc-stan.org/t/how-to-vectorize-the-stan-code-to-reduce-the-run-time/37554 "2024-12-10T21:42:42Z")

</div>

I have this below STAN code for marketing mix modelling application with thousands records and hundreds of media/control variables. Using\*\* pystan version 2.19.1.1\*\* I am new to stan. This current setup is taking 10-12 h…

---

## [Label Switching for 3 Components and 6 Classes - unimodal curves](https://discourse.mc-stan.org/t/label-switching-for-3-components-and-6-classes-unimodal-curves/37134)

<div class="topic-metadata">

**Author:** [@Tomas\_Bedac](https://discourse.mc-stan.org/u/Tomas_Bedac)\
**Replies:** 1\
**Last updated:** [November 4, 2024, 9:45pm UTC](https://discourse.mc-stan.org/t/label-switching-for-3-components-and-6-classes-unimodal-curves/37134 "2024-11-04T21:45:13Z")

</div>

Hello everyone, I’m having issues with label switching in a model with 3 components and 6 classes that I want to infer. My dataset consists of 4 columns with N data points, each of which belongs to one of 6 classes: jjj…

---

## [Issues with stan in python: error Command 'make' error during processing No such file or directory](https://discourse.mc-stan.org/t/issues-with-stan-in-python-error-command-make-error-during-processing-no-such-file-or-directory/36790)

<div class="topic-metadata">

**Author:** [@madelynandersen](https://discourse.mc-stan.org/u/madelynandersen)\
**Replies:** 11\
**Last updated:** [October 8, 2024, 9:27pm UTC](https://discourse.mc-stan.org/t/issues-with-stan-in-python-error-command-make-error-during-processing-no-such-file-or-directory/36790 "2024-10-08T21:27:54Z")

</div>

Hi, I am trying to use stan in python to fit a 1d gaussian toy problem with a specified prior on the mean. I have been successful using R, but I need to also use python. I have tried using pystan (to no success - I would…

---

## [How to change adapt\_delta on pystan 3.9.1?](https://discourse.mc-stan.org/t/how-to-change-adapt-delta-on-pystan-3-9-1/34945)

<div class="topic-metadata">

**Author:** [@confused\_dude](https://discourse.mc-stan.org/u/confused_dude)\
**Replies:** 4\
**Last updated:** [September 16, 2024, 1:07am UTC](https://discourse.mc-stan.org/t/how-to-change-adapt-delta-on-pystan-3-9-1/34945 "2024-09-16T01:07:24Z")

</div>

Hi everyone. Basically, I am new to Pystan, I used to work with Rstan. In R stan this was easy: ...,control = list(adapt\_delta = 0.999, stepsize = 0.001, max\_treedepth = 12) It was also easy on the previous versions o…

---

## [Pystan3 in UDF gives error](https://discourse.mc-stan.org/t/pystan3-in-udf-gives-error/35090)

<div class="topic-metadata">

**Author:** [@SaraAliza](https://discourse.mc-stan.org/u/SaraAliza)\
**Replies:** 2\
**Last updated:** [July 15, 2024, 6:32pm UTC](https://discourse.mc-stan.org/t/pystan3-in-udf-gives-error/35090 "2024-07-15T18:32:16Z")

</div>

Upgrading from pystan 2.19.1.1 to pystan 3.9.1, gives the following error when using UDF in pyspark. Running the same function without UDF works fine. This is getting executed in azure Databricks. import stan import nes…

---

## [Pystan and httpstan maintenance hiatus](https://discourse.mc-stan.org/t/pystan-and-httpstan-maintenance-hiatus/35825)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 1\
**Last updated:** [July 11, 2024, 8:15pm UTC](https://discourse.mc-stan.org/t/pystan-and-httpstan-maintenance-hiatus/35825 "2024-07-11T20:15:19Z")

</div>

Hi everyone, I’m planning on taking a break from pystan and httpstan maintenance starting in September. My work developing and maintaining software such as pystan has been supported by my job at Indiana University. In S…

---

## [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

---

## [Does pystan3 supports custom build/compile locations for its model cache](https://discourse.mc-stan.org/t/does-pystan3-supports-custom-build-compile-locations-for-its-model-cache/35639)

<div class="topic-metadata">

**Author:** [@SaraAliza](https://discourse.mc-stan.org/u/SaraAliza)\
**Replies:** 5\
**Last updated:** [June 29, 2024, 9:16pm UTC](https://discourse.mc-stan.org/t/does-pystan3-supports-custom-build-compile-locations-for-its-model-cache/35639 "2024-06-29T21:16:19Z")

</div>

I am getting a read-only error when running pystan3 build() in a UDF. I think the issue is related to the location that the code is being run from, which is read-only. I am looking to set a custom cache location to be s…

---

## [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,…

---

## [Cannot compile pystan (macOS M2)](https://discourse.mc-stan.org/t/cannot-compile-pystan-macos-m2/32274)

<div class="topic-metadata">

**Author:** [@shuhei](https://discourse.mc-stan.org/u/shuhei)\
**Replies:** 3\
**Last updated:** [April 15, 2024, 10:40am UTC](https://discourse.mc-stan.org/t/cannot-compile-pystan-macos-m2/32274 "2024-04-15T10:40:11Z")

</div>

How to solve the error “command ‘x86\_64-apple-darwin13.4.0-clang’ failed: No such file or directory”. I use ・Mac book air with M2. ・Anaconda ・python 3.9.16 I could import pystan but I cannot compile.

---

## [Problems with installing Pystan in Python 3.10 on Ubuntu 20.04 LTS](https://discourse.mc-stan.org/t/problems-with-installing-pystan-in-python-3-10-on-ubuntu-20-04-lts/29266)

<div class="topic-metadata">

**Author:** [@avdvloet](https://discourse.mc-stan.org/u/avdvloet)\
**Replies:** 18\
**Last updated:** [April 7, 2024, 1:57pm UTC](https://discourse.mc-stan.org/t/problems-with-installing-pystan-in-python-3-10-on-ubuntu-20-04-lts/29266 "2024-04-07T13:57:16Z")

</div>

I have troubles installing Pystan in Python 3.10 on my Ubuntu 20.04 system. I have already tried all the possible troubleshooting, as well as e.g. a similar issue (Error installing Pystan in python 3.10 with gcc 9.2.0). …

---

## [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: My model has parameters but the error says It doesn't!](https://discourse.mc-stan.org/t/pystan-my-model-has-parameters-but-the-error-says-it-doesnt/33908)

<div class="topic-metadata">

**Author:** [@llvllahsa](https://discourse.mc-stan.org/u/llvllahsa)\
**Replies:** 1\
**Last updated:** [February 6, 2024, 10:25pm UTC](https://discourse.mc-stan.org/t/pystan-my-model-has-parameters-but-the-error-says-it-doesnt/33908 "2024-02-06T22:25:06Z")

</div>

Hi, In a project on linux, I am using pystan 2.19.1.1, stan\_utility 0.1.2, gcc-9 and g++ -9. when I call the function fit = model.sampling(data=data\_doublesigmoid\_toy, seed=8453462, chains=4, iter=1000, n\_jobs=1) It …

---

## [Compilation never ends](https://discourse.mc-stan.org/t/compilation-never-ends/33872)

<div class="topic-metadata">

**Author:** [@llvllahsa](https://discourse.mc-stan.org/u/llvllahsa)\
**Replies:** 6\
**Last updated:** [January 22, 2024, 3:23pm UTC](https://discourse.mc-stan.org/t/compilation-never-ends/33872 "2024-01-22T15:23:49Z")

</div>

Hi, I am stuck with this for a while, nothing comes to do so as to fix it! In a project on linux, I am using pystan 2.19.1.1, stan\_utility 0.1.2, gcc-9 and g++ -9. when I call the function stan\_utility.compile\_model(…

---

## [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 …

---

## [How to use prior from a sample?](https://discourse.mc-stan.org/t/how-to-use-prior-from-a-sample/33129)

<div class="topic-metadata">

**Author:** [@deltasata](https://discourse.mc-stan.org/u/deltasata)\
**Replies:** 5\
**Last updated:** [October 25, 2023, 12:54pm UTC](https://discourse.mc-stan.org/t/how-to-use-prior-from-a-sample/33129 "2023-10-25T12:54:51Z")

</div>

Hi, I want to fit with 20 parameters. For 5 of them I want to use a prior drawn from a 5D sample (I got this from a previous fit). I emphasize that my priors are not simple analytical functions, rather I have this 5D sa…

---

## [CompileError: even after successfully installing pystan](https://discourse.mc-stan.org/t/compileerror-even-after-successfully-installing-pystan/22991)

<div class="topic-metadata">

**Author:** [@Huaiyang\_Gongzi](https://discourse.mc-stan.org/u/Huaiyang_Gongzi)\
**Replies:** 5\
**Last updated:** [October 12, 2023, 7:01am UTC](https://discourse.mc-stan.org/t/compileerror-even-after-successfully-installing-pystan/22991 "2023-10-12T07:01:59Z")

</div>

Hello, I installed pystan on Windows using Anaconda, i.e., pip install pystan. The installation process finished successfully. But running the following code will generate the error message as follows coin\_code = """…

---

## [Pystan3, compiling a model and using with different data](https://discourse.mc-stan.org/t/pystan3-compiling-a-model-and-using-with-different-data/31744)

<div class="topic-metadata">

**Author:** [@dherrera1911](https://discourse.mc-stan.org/u/dherrera1911)\
**Replies:** 4\
**Last updated:** [October 11, 2023, 3:13pm UTC](https://discourse.mc-stan.org/t/pystan3-compiling-a-model-and-using-with-different-data/31744 "2023-10-11T15:13:59Z")

</div>

I have experience using Stan in R, but now I am starting to use Stan through Python. I see that there has been a major update in PyStan3, which is the version I installed. There are two things that are annoying me in sta…

---

## [I cannot run simple examples in pystan](https://discourse.mc-stan.org/t/i-cannot-run-simple-examples-in-pystan/32777)

<div class="topic-metadata">

**Author:** [@fponce](https://discourse.mc-stan.org/u/fponce)\
**Replies:** 3\
**Last updated:** [September 18, 2023, 11:49am UTC](https://discourse.mc-stan.org/t/i-cannot-run-simple-examples-in-pystan/32777 "2023-09-18T11:49:15Z")

</div>

I am following this tutorial, but the examples do not run. I have compiled successfully models with pystan recently, but these examples without model or data block seem problematic. The first example is: data { int\<l…

---

## [Using ode\_rk45\_tol without knowing the output size](https://discourse.mc-stan.org/t/using-ode-rk45-tol-without-knowing-the-output-size/32532)

<div class="topic-metadata">

**Author:** [@Daniel-Rogo](https://discourse.mc-stan.org/u/Daniel-Rogo)\
**Replies:** 2\
**Last updated:** [August 24, 2023, 10:47pm UTC](https://discourse.mc-stan.org/t/using-ode-rk45-tol-without-knowing-the-output-size/32532 "2023-08-24T22:47:03Z")

</div>

Hello, For my model, I have to use an ode solver. However I have two questions for the ode\_rk45\_tol function available in stan. First, the documentation of this function is: 'ode\_rk45\_tol(function ode, vector initial\_s…

---

## [From rstan to pystan 3 when permutation = TRUE and "Fixed\_param" are present](https://discourse.mc-stan.org/t/from-rstan-to-pystan-3-when-permutation-true-and-fixed-param-are-present/31772)

<div class="topic-metadata">

**Author:** [@Joe\_Suzuki](https://discourse.mc-stan.org/u/Joe_Suzuki)\
**Replies:** 4\
**Last updated:** [June 18, 2023, 10:13pm UTC](https://discourse.mc-stan.org/t/from-rstan-to-pystan-3-when-permutation-true-and-fixed-param-are-present/31772 "2023-06-18T22:13:57Z")

</div>

I have been using stan in R, and now I’m trying to execute it using pystan 3. I’m not sure if the following code is correct. The output seems to differ significantly. However, I refer to Listing 2 in the document “https:…

---

## [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…

---

## [RuntimeError - Initialization failed](https://discourse.mc-stan.org/t/runtimeerror-initialization-failed/30376)

<div class="topic-metadata">

**Author:** [@Jonas-JP-Peeters](https://discourse.mc-stan.org/u/Jonas-JP-Peeters)\
**Replies:** 4\
**Last updated:** [February 14, 2023, 3:24pm UTC](https://discourse.mc-stan.org/t/runtimeerror-initialization-failed/30376 "2023-02-14T15:24:49Z")

</div>

I’m trying to fit two AR(1) latent state variables using one time series. c\_t = \\mu + s\_t + l\_t + \\sigma\_g \\varepsilon\_{g,t} where s\_t = \\rho\_s s\_{t-1} + \\sigma\_s \\varepsilon\_t and l\_t = \\rho\_l l\_{t-1} - sigma\_l \\va…

---

## [Lower bound in parameter vector causes GP to have nan values](https://discourse.mc-stan.org/t/lower-bound-in-parameter-vector-causes-gp-to-have-nan-values/30326)

<div class="topic-metadata">

**Author:** [@AndreasB](https://discourse.mc-stan.org/u/AndreasB)\
**Replies:** 0\
**Last updated:** [February 9, 2023, 3:47pm UTC](https://discourse.mc-stan.org/t/lower-bound-in-parameter-vector-causes-gp-to-have-nan-values/30326 "2023-02-09T15:47:08Z")

</div>

I try to explore the likelihood surface of a Gaussian Process with regard to its parameters. All of this is done with pystan. If I run the following python/Stan code I sometimes get the following error: Informational…

---

## [Bayesian Mixture Model](https://discourse.mc-stan.org/t/bayesian-mixture-model/29896)

<div class="topic-metadata">

**Author:** [@DIVAGORA](https://discourse.mc-stan.org/u/DIVAGORA)\
**Replies:** 2\
**Last updated:** [December 29, 2022, 7:35am UTC](https://discourse.mc-stan.org/t/bayesian-mixture-model/29896 "2022-12-29T07:35:51Z")

</div>

I’m newbie using STAN. I’m trying to perform a Bayesian mixture model (mixing Gaussian and GEV distributions). However, the model has convergence problem. Any comments on improving it.Thanks! functions{ real gev…

---

## [Problems installing PyStan 3 on macOS Mojave (10.14)?](https://discourse.mc-stan.org/t/problems-installing-pystan-3-on-macos-mojave-10-14/24949)

<div class="topic-metadata">

**Author:** [@ariddell](https://discourse.mc-stan.org/u/ariddell)\
**Replies:** 2\
**Last updated:** [November 26, 2022, 2:28pm UTC](https://discourse.mc-stan.org/t/problems-installing-pystan-3-on-macos-mojave-10-14/24949 "2022-11-26T14:28:00Z")

</div>

Are people using macOS 10.14 (released in 2018) able to install the newest version of httpstan (which PyStan 3 depends on)? The wheel on PyPI has a tag macosx\_10\_15\_x86\_64, which makes me think it may not work on macOS …

---

## [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

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