David Schmudde / Jun 03 2019

Automatic Dependency Management

This notebook begins by using Nextjournal's default Python environment.

import platform; platform.python_version()
'3.6.8'

The environment comes pre-loaded with dozens of useful packages. Use Bash in Nextjournal just as you would on your local machine to see what packages are installed.

conda list; printf "\npip packages:\n"; pip list

Installation using Bash also works as expected.

pip install haishoku

Jupyter users should note - there is no kernel mediating the Bash commands in these cells. It is exactly like running /bin/bash on your local machine. This solves many problems that emerge when using Jupyter notebooks:

  • The notebooks are not dependent on the system's version of Python. Use any version of Python you want. Upgrade the system without fear of breaking an unrelated notebook or its dependencies.
  • Package installation is simplified. On any given computer, a Jupyter kernel's python executable not always the same as the command line's python executable. Related dependency errors are difficult to trace.
  • Dependency management on Nextjournal is automated for each individual notebook.

Best of all, the benefits of Nextjournal can be leveraged by Jupyter users. Nextjournal's support for Jupyter kernel means that the notebook can be run on the platform, including all custom Magic commands:

!jupyter --version

Running a Jupyter notebook just once on Nextjournal makes it instantly reproducible and will alleviate dependency issues in the future.