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 $keyurlsha256sum -c --ignore-missing $shafileexport GNUPGHOME="$(mktemp -d)"gpg --import $keyfilegpg --batch --verify $sigfile $tarfilegpgconf --kill allcp $tarfile /results/julia.tar.gzrm -rf "$GNUPGHOME" $tarfile $sigfile $shafile $keyfileInstall from saved archive.
mkdir -p "$JULIA_PATH"tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1And verify it runs.
julia -vInstall a few system tools and libraries.
apt-get -qq updateDEBIAN_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 cleanrm -r /var/lib/apt/lists/* # Clear package list so it isn't staleconda install -y matplotlibmkdir -p ~/.julia/configcp /root/.juliarc.jl ~/.julia/configInstall required packages
JSON.jlis required to run on Nextjournal.Conda.jl, which is set to use the existing Conda installation via theCONDA_JL_HOMEenvironment variable.Python packages like
PyPlot.jlandIJUlia.jl.
julia -e 'import Pkg; Pkg.add(["JSON", "Conda", "PyPlot", "IJulia"])'PLOTS_DEFAULTS = Dict(:fontfamily => "Open Sans")