A Docker compose project to stand up a Jupyter notebook server with nbstata
, so you can use Jupyter as a first-class UI for Stata.
pystata
, on which nbstata
depends, comes with Stata 17+. Older versions of Stata will not work.
The image expects you to supply it with a valid stata.lic
file. Get this from your local install of Stata, or from your IT department.
Put a copy of it in the same directory as docker-compose.yml
, or override the file
key for the stata_lic
secret to tell Docker where it is.
If you are on Linux, your license file is probably at /usr/local/stata/stata.lic
. On Macs it is at /Applications/Stata/stata.lic
. I have no idea where it lives on Windows, but probably in the same place as the Stata exe
file.
$ docker compose up
Everything should Just Work. Caution: the build process will download several gigabytes of data, because Stata installs are big. As much of this is cached (using Docker cache-mounts) as possible.
If you are on an M1 Mac, the image will run under Rosetta, because there is no AArch64 build of Stata for Linux.
Rename docker-compose.override.sample.yml
to docker-compose.override.yml
and anything you set in it will override the base config. (See the Compose documentation for more information.)
The comments explain what you can override. In particular you will probably want to override stata_edition
if your licence can accommodate it.
- First inspired by David T. Jacho–Chávez's “virtual econometrics lab”
- kylebarron/stata_kernel for the original, pre-
pystata
Stata kernel for JupyterLab that made this possible - ticoneva/pystata-kernel for building the new
pystata
-based kernel and hugetim/nbstata for carrying it forward - AEADataEditor/docker-stata for the docker image that makes building
this vastly less painful than it was, and for the idea of mounting
stata.lic
as a secret