by Joseph KliegmanSep 20 2018
Chief Scientist, Nextjournal

TDA environment

Creating and saving a Nextjournal environment

Each Nextjournal code cell runs in a runtime, and each runtime has an environment, which is a Docker container with its own filesystem. In any environment we can install whatever system or language packages we need, modify configuration files, and set up directory and data file structures however we like. Then, we can save and export the environment as a whole for future reproducibility, as well as use by others.

pip freeze

When we need additional Python packages, they can be installed in multiple ways. The easiest way is to use conda, which will attempt to install all packages and dependencies in a consistent manner, including system packages and libraries. The Anaconda Cloud has a searchable database of packages and channels—by default we will select only from the anaconda channel.

conda install -y \
  descartes pysal scikit-learn netcdf4 \
  basemap pyproj Cython
conda install -y -c jjhelmus \
  trmm_rsl pyglpk cvxopt

For packages and versions unavailable via conda, or for installing packages in wheel files, pip is available. For any packages that require compilation, we can install gcc first.

apt-get update > /dev/null
apt-get install -y build-essential gcc gfortran git

Finally, if a package has a, we can download and install with that.

rm -rf PyTDA pyart
git clone
git clone
export RSL_PATH=/opt/conda
cd pyart && python install
cd PyTDA && python install