Installing and configuring packages
In Nextjournal’s runtimes you can install any package or library, and configure them in whatever way works best for you. For most programming languages, the preferred way of installing packages will be to use a Bash script, but some, like R, might use their own runtime for it. Here, we first recap quickly on how to use Bash cells for installing packages (that you can skip if you've already read this guide), and then provide a collection of examples of package installations in different languages.
Using Bash for package installation
Currently, the language used for code cells and their corresponding runtimes are coupled, meaning a Python runtime will only use Python cells, a R runtime only R cells, and so on. Bash is an exception here. Since Bash is often used to install packages, Nextjournal allows assigning Bash cells to other language runtimes.
Nextjournal tries to facilitate the process by guessing your intent when you add a Bash cell:
If no other runtimes exist, Nextjournal will add a standalone Bash runtime.
If other, non-Bash runtimes exist, Nextjournal will take the most recent cell’s runtime and assign the Bash cell to that runtime, assuming that you want to install packages for it. This will be indicated by Bash in [Language] in the bottom right corner of a code cell:
pip install climtManually assigning cells to runtimes
You can always manually assign your Bash cells to different runtimes: simply open the Bash cell’s options menu and select Change runtime…, then select the runtime you want it to assign to:

Installing Packages
Each Nextjournal runtime comes with an environment based on Ubuntu 18.04 LTS. This means that you can install packages from files via dpkg, or fetch them from repositories with apt-get. Nextjournal’s default environments don’t have package lists stored so an apt-get update might be required first:
apt-get updateapt-get install fortune cowsay/usr/games/fortune | /usr/games/cowsayPrevent having to re-install packages
A Nextjournal runtime’s file system state is transient by default. This means that whenever the runtime shuts down or is reset (either by your action or because it automatically shut down after 20 minutes of idle time), all installed packages are lost and have to be re-installed again. To prevent this, save your environment after installing packages to persist their file system state and all installed packages. You might want to read How to reuse your environments for a short tutorial. Once you saved the runtime’s environment, you can assign it to your runtime so your code cells have the packages available to them.
What follows here is a collection of examples on how to install packages for individual programming languages.
Installing Python Packages
Nextjournal's default Python 2 and 3 environments have a number of basic data and plotting packages installed, including numpy, matplotlib, and plotly:
pip freezeWhen additional Python packages are required, you can install them in multiple ways. The easiest 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 conda will select only from the anaconda channel.
conda install descartes pysalAdditional channels can be added with the -c flag.
conda install -c conda-forge cartopyFor packages and versions unavailable via conda, or for installing packages distributed as wheel files, pip is available. For any packages that require compilation, gcc is available along with the most common build tools.
pip install quilt mapclassifyYou can also use pip to install development versions from git repos.
pip install git+https://github.com/geopandas/geopandas@masterFinally, if a package has a setup.py, you can download and install with that.
git clone https://github.com/ResidentMario/geoplotcd geoplotgit checkout 328cc9d5f8c02470c6257f2bf2fb2f3c5304530fpython setup.py installInstalling Clojure Packages
The default Clojure environment provides Clojure v1.10.0. Other versions, and any required libraries or packages, can be installed using a deps.edn file. In order to ensure loading when the runtime boots, this file must be created by inserting a Code Listing. Simply click the + button between nodes and select Code Listing, then set its language (in the bottom right corner) to Extensible Data Notation, and assign it deps.edn as its name using its options menu (•••) in the upper left corner. The following example will install the clj-xchart library:
{ :deps { com.hypirion/clj-xchart {:mvn/version "0.2.0"} org.clojure/clojure { :mvn/version "1.10.0-beta8" }}}Your deps.edn can then be mounted into the Clojure runtime’s file system to be read at boot time using the runtime’s settings panel:

Booting will take an extended length of time because of the installation happening through deps.edn. It is advisable to save the environment once all of the packages are installed so you not have to run through this process whenever you reset the runtime.
System packages that are required for clj-xchart can be installed via a Bash cell:
apt-get updateapt-get install --no-install-recommends \ fontconfig libxext6 libxrender1 libxtst6 libxi6Once everything has been installed, we can require clj-xchart:
(require [com.hypirion.clj-xchart :as c])Installing Julia Packages
The Julia default environment includes a wide variety of file-handling and data processing packages, as well as the Plots and Makie graphical frameworks.
inst = Pkg.installed()foreach(key-> println("$key v$(inst[key])"), keys(inst))Installation of additional packages is done via the the standard Julia Pkg interface: update will upgrade all packages with newer versions available, and add will install new packages. Running precompile before saving an environment will speed up package loading in the future.
pkg"add LightGraphs GraphPlot"pkg"precompile"One can also use the `]` pkg mode to install packages:
]up; add UnicodeFunInstalling R Packages
The R environment includes the tidyverse, and the plotly and ggplot2 graphical packages.
inst = installed.packages()[,c("Package","Version")]inst[order(tolower(inst[,"Package"])),]As always, a Bash cell can install additional dependencies:
apt-get updateapt-get install libudunits2-devapt-get cleanInstallation of additional R packages is done via the the standard R function install.packages(), or the devtools function install_github(). Build tools, including gcc, are included for package compilation.
install.packages(c("ggraph","igraph"))devtools::install_github("sjmgarnier/viridis")Once the packages have been installed, we can require them:
library(ggraph)library(igraph)library(tidyverse)library(viridis)Configuring Packages
Environment Variables
Besides using a Bash script for configuration, or a deps.edn code listing mounted into Clojure runtimes (see section above), any runtime also has full control over its environment variables. To create or override env variables, open a runtime’s settings panel, and expand the Environment Variables & Secrets section:

⚠️: the runtime must be booted up in order for its inherited environment variables to be shown.