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.
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_VERSION | 1.6.2 |
CONDA_JL_HOME | /opt/conda |
JSSERVE_LISTEN_URL | 0.0.0.0 |
GKSwstype | png |
DISPLAY | :0 |
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
Install from saved archive.
mkdir -p "$JULIA_PATH"
tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1
And verify it runs.
julia -v
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
Install required packages
JSON.jl
is required to run on Nextjournal.Conda.jl
, which is set to use the existing Conda installation via theCONDA_JL_HOME
environment variable.Python packages like
PyPlot.jl
andIJUlia.jl
.
julia -e 'import Pkg; Pkg.add(["JSON", "Conda", "PyPlot", "IJulia"])'
PLOTS_DEFAULTS = Dict(:fontfamily => "Open Sans")