Interactive PyStan notebooks with MyBinder

MyBinder allows running Python notebooks from github repos, and it’s free at least now when it’s in beta.

To prepare a repo it’s enough to add one text file for listing dependencies. See instructions here

After this go to and enter your repo address and possible branch and path. MyBinder makes a docker image and runs it in their server. You can also share a link and docker images are stored so that it’s fast to try a ready made binder.

You can try running Python notebooks in my BDA course notebook collections (there are also couple PyStan notebooks there)


Nice! I’m curious what people who’ve used it make of it. Is it reliable? How fast are the cycles you get?

Hi @avehtari. Have you had much luck compiling a more recent version of pystan (your example is using 2.16)? I am relying on the in-built layers and images, which are outdated at some point. Perhaps I should set up dockerfiles instead.

I am getting this error:

Installing pip dependencies: …working… Ran pip subprocess with arguments:
[’/srv/conda/envs/notebook/bin/python’, ‘-m’, ‘pip’, ‘install’, ‘-U’, ‘-r’, ‘/home/jovyan/condaenv.7i0lwggp.requirements.txt’]
Pip subprocess output:
Collecting pystan==3.2.0
Downloading pystan-3.2.0-py3-none-any.whl (13 kB)
Collecting aiohttp<4.0,>=3.6
Downloading aiohttp-3.7.4.post0.tar.gz (1.1 MB)
Installing build dependencies: started
Installing build dependencies: finished with status ‘done’
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status ‘done’
Preparing wheel metadata: started
Preparing wheel metadata: finished with status ‘done’
Collecting clikit<0.7,>=0.6
Downloading clikit-0.6.2-py2.py3-none-any.whl (91 kB)

Pip subprocess error:
ERROR: Could not find a version that satisfies the requirement httpstan<4.6,>=4.5 (from pystan) (from versions: 0.2.5, 0.3.0, 0.3.1, 0.4.0, 0.5.0, 0.6.0, 0.7.2, 0.7.3, 0.7.5, 0.7.6, 0.8.0, 0.9.0, 0.10.1)
ERROR: No matching distribution found for httpstan<4.6,>=4.5

CondaEnvException: Pip failed

I’ve not used PyStan regularly. Maybe @ahartikainen or @ariddell can help (they may be on summer vacation if they are not responding)

1 Like

I have the same problem on a large Ubuntu machine (python 3.8.10): I cannot get access to a newer version of httpstan through pip than 4.4.2. therefore pystan3 won’t install.
Yet on my Ubuntu laptop (python 3.9.5) pystan3 (and httpstan 4.5) seem to have installed no problem with pip.

httpstan is unfortunately a bit demanding in terms of its supported operating systems. The PyStan documentation is fairly good on this point (please open an issue if anything is unclear): Installation — pystan 3.2.0 documentation

To use the httpstan wheels on Linux you need an x86-64 machine and need to be using a very recent version of your Linux operating system. For example, httpstan wheels only work on Ubuntu 20.04 and higher.

1 Like

Thanks. Yes, the server is on Ubuntu 20.04.2 LTS, but can’t see httpstan>4.4.2, while my latptop is on Ubuntu 21.04 and isn’t. Both are x86-64.

The instructions you link to tell me to build httpstan manually, but I cannot follow them. IT says:

python3 -m pip install poetry

Of course that results in “no makefile found” unless I have the bad luck of being somewhere with a random makefile locally.

The solution was …

pip install --upgrade pip

!! :)
Now pip install pystan 3 and dependencies fine by default.

1 Like