Skip to Main Content

Software Carpentry

Installing the STATA kernel for Jupyter Lab

Prerequisites

  1. The default Python is Python 3 (i.e. the python --version command returns "Python 3.<release number>.<bugfix number>"
  2. Jupyter Lab is installed
  3. You have a local installation of STATA

The easiest way to meet these prerequisites is to install Python via the Anaconda distribution, but that isn't required if you installed everything some other way.

Install

  1. Download and install Node.js from https://nodejs.org/en/ (if you don't know which version to select, choose the Long-Term Support [LTS] release).
  2. Open the Finder and navigate to your home directory. Press Cmd + Shift + . to display hidden files.
  3. Open the .condarc file with a text editor. Replace the contents of your .condarc file with the .condarc file shown below.
  4. To enable syntax highlighting for STATA, open the Terminal and run the following command:
    jupyter labextension install jupyterlab-stata-highlight
  5. The command to install the STATA kernel will differ based on your STATA version and your Python distribution:
    • If you are using STATA 17, open the Terminal and run:
      pip install git+https://github.com/mcaceresb/stata_kernel.git@dev-stata17-graph-fix
    • If you are using STATA 16 or earlier and you installed Python via the Anaconda distribution, open the Terminal and run:
      conda install stata_kernel 
    • If you are using STATA 16 or earlier and you installed Python in another way, open the Terminal and run:
      pip install stata_kernel
  6. Then open the Terminal and run:
    python -m stata_kernel.install

.condarc

ssl_verify: true
channels:
  - defaults
  - conda-forge
channel_priority: strict
unsatisfiable_hints: true

.stata_kernel.conf