PyStan license


As you all know, the PyStan license is GPL-3, while the Stan core is BSD. In some corporate environments this causes a number of issues, and means we can’t use Stan effectively. It also means we can’t use derived works like Prophet.

I understand that RStan does this because of how it uses (used?) the GPL Rcpp package (and that GPL is much more common in the R world). I’m not aware of any reason besides developer preference for PyStan not being available BSD, which is quite common in the python data science world (NumPy, Pandas, SciPy, Scikit-Learn, and Cython are all BSD or BSD compatible Apache or MIT). Would the Stan team (and particularly @ariddell, who seems to be the main contributor) be willing to consider a BSD compatible license for PyStan?


(n.b., 2014 thread here)


PyStan is GPL’d because it is substantially derived from RStan (see
files like stan_fit.hpp). RStan is GPL3’d.

I am planning on rewriting PyStan this year (as part of a long-awaited
refactoring) and will likely use the MIT or CC0 license.


Given that we own the IP for RStan, we’re not restricted on how we license PyStan. We could just release it under an MIT license now.

I have wanted to release it under BSD all along given that we’re not restricted by the Python license.

We could, in fact, release RStan under BSD, but given that it’s ony useful with the GPL-ed R package, I didn’t see the point.


Hi, I’m ccing Bob as he’s the one who decided on the license.


Allen decided on the GPL for PyStan.


The first version of PyStan copied a lot of code from RStan which was
GPL3’d at the time. That’s why PyStan is GPL3’d. (Had it been up to me I
would have picked MPL.)

Now I’m fine with CC0 or MIT for PyStan.


I don’t know CC0, so would you mind changing the license to the MIT license? As I said before, given that we wrote RStan, we’re free to use it however we want and license it however we want. I can change our top-level web site after you do that. Thanks!


Whatever you pick for RStan, I’ll have to use that for PyStan. The first
version of PyStan, on my reading of things, was a derivative work of RStan.


The RStan license is irrelevant. Just because PyStan was derived from RStan, doesn’t mean we have to release them both under the same license. If we own a piece of IP, we can license it to different people under different licenses.

For example, MySQL released their software under the GPL and also sold non-GPL licenses. No issue whatsoever and no conflict because they owned the IP. A third party who used it under the GPL couldn’t remove the GPL, but the owners of the IP can license it however they want.

If a third party had written RStan, we’d have to abide by their license or negotiate a separate license.


I’m happy to relicense PyStan as MIT if RStan is released under a
permissive license.

The PyStan rewrite will be MIT and/or CC0 licensed as it will not depend
on any of the GPLv3 code in RStan. I hope to get the rewrite done before


Any word on when the PyStan rewrite will be done? I sure could use a BSD-compatible Python interface for Stan around now…


A significant amount of work has been done. There may be an alpha
version before the end of the month.


Thanks Allen! I really appreciate that.


I strongly second the sentiment would not spend time using pystan under gpl v3 restrictions


Is there still a reason you don’t want to release the current PyStan under BSD-3?


Because several files in PyStan are (transparently) derived from RStan
(e.g., stan_fit.hpp), which were and still are available under the GPL.

I suppose it all could be relicensed under BSD-3 if the version of RStan
from which PyStan took the files were publicly released under a BSD-3

I’ll have a (minimal) working example of PyStan 3 out soon. I’m just
finishing writing the documentation and bringing the tests over. I had
hoped to get this done before the semester started.


If you’re really going to release PyStan 3 ahead of the rest of Stan 3, then that’s a fine way to go and will render this discussion moot.

Did I not forward you the message from the NumFOCUS IP lawyer? I’ll do that now.

This is completely irrelevant. A copyright holder may release their IP under multiple licenses without conflict. For example, we did a GPL release of Stan for JStatSoft before they changed their mind about IP requirements and allowed BSD submissions.

According to the lawyer, that’s not required, as translated code is not considered a derived product. I think the reasoning here is that code is only copyrighted, whereas algorithms require patents.


Hi Bruce,

Would you mind elaborating a bit? I would also be interested in knowing if you work in industry or academia.



Corey, could you elaborate a bit on your need for a permissive license a bit? I’d also ask the same question I asked @bhomass – are you in academia or industry?


I used to be in academia. I am now in industry. why does that matter?