Setup Minimal Julia 1.x Environment

This notebook describes and creates the default Julia environments in Nextjournal. It is based on the the Python environment.

We'll base our environment off of our Minimal Python image, which has a small conda Python setup. Note that the Julia version is set as an environment variable on the runtime.

Julia 1.6.2 Base
Julia 1.6.2 Base (Bash) using
exporting environment
Type: Nextjournal
Environment:
Machine Type:
Environment Variables:
PATH/usr/local/julia/bin:/opt/conda/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
JULIA_PATH/usr/local/julia
JULIA_VERSION1.6.2
CONDA_JL_HOME/opt/conda
JSSERVE_LISTEN_URL0.0.0.0
GKSwstypepng
DISPLAY:0
Download this environment as a Docker image from:

The exact version we're installing is 1.6.1. Here we download the archive and signatures, verify, and save. The cell is locked to prevent redownload.

tarArch="x86_64"
dirArch="x64"
BASEURL="https://julialang-s3.julialang.org/bin"
tarfile="julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"
dir="${dirArch}/${JULIA_VERSION%[.-]*}"
tarurl="${BASEURL}/linux/${dir}/${tarfile}"
sigfile="${tarfile}.asc"
sigurl="${tarurl}.asc"
shafile="julia-${JULIA_VERSION}.sha256"
shaurl="${BASEURL}/checksums/${shafile}"
keyfile="juliareleases.asc"
keyurl="https://julialang.org/assets/${keyfile}"
wget -q --show-progress --progress=bar:force \
  $tarurl $sigurl $shaurl $keyurl
sha256sum -c --ignore-missing $shafile
export GNUPGHOME="$(mktemp -d)"
gpg --import $keyfile
gpg --batch --verify $sigfile $tarfile
gpgconf --kill all
cp $tarfile /results/julia.tar.gz
rm -rf "$GNUPGHOME" $tarfile $sigfile $shafile $keyfile
3.9s

Install from saved archive.

mkdir -p "$JULIA_PATH"
tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1
5.7s

And verify it runs.

julia -v
0.9s

Install a few system tools and libraries.

apt-get -qq update
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends \
  imagemagick libhdf5-dev hdf5-tools mesa-utils \
  libxt6 libxrender1 libgl1-mesa-glx libqt5widgets5 `# for GR` \
  libhttp-parser2.7.1 `# for PlotlyJS`
apt-get clean
rm -r /var/lib/apt/lists/* # Clear package list so it isn't stale
conda install -y matplotlib
mkdir -p ~/.julia/config
cp /root/.juliarc.jl ~/.julia/config
71.7s

Install required packages

  • JSON.jl is required to run on Nextjournal.

  • Conda.jl, which is set to use the existing Conda installation via the CONDA_JL_HOME environment variable.

  • Python packages likePyPlot.jl and IJUlia.jl.

julia -e 'import Pkg; Pkg.add(["JSON", "Conda", "PyPlot", "IJulia"])'
49.1s
PLOTS_DEFAULTS = Dict(:fontfamily => "Open Sans")
Julia

Runtimes (1)