Micah P. Dombrowski / Aug 20 2019

Julia 0.7 Environment

Setup

Build a Minimal Julia 0.7 Environment

We'll base our environment off of our Minimal Bash image. Note that the Julia version is set as an environment variable on the runtime.

Minimal Julia 0.7
Minimal Julia 0.7 (Bash)
exporting environment
The exported environment has changes that need to be saved.
Type: Nextjournal
Environment:
Resources:
Environment Variables:
JULIA_VERSION0.7.0
JULIA_PATH/usr/local/julia
PATH/usr/local/julia/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Download this environment as a Docker image from:

Download the archive and signatures.

tarArch='x86_64'
dirArch='x64'
JULIA_VERSION_SHORT=${JULIA_VERSION/-rc/}
FILENAME="julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"
FILEURL="https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION_SHORT%[.-]*}/${FILENAME}"

echo "Downloading ${FILEURL}."

curl -fL -o julia.sha256 \
  "https://julialang-s3.julialang.org/bin/checksums/julia-${JULIA_VERSION}.sha256"
curl -fL -o julia.tar.gz.asc "${FILEURL}.asc"
curl -fL -o julia.tar.gz "${FILEURL}"

echo `grep $FILENAME julia.sha256 | cut -d " " -f1` > j256sig

Check the signatures to verify our download.

sha256=`cat j256sig`
echo "${sha256} *julia.tar.gz" | sha256sum -c -

export GNUPGHOME="$(mktemp -d)"
JULIA_GPG="3673DF529D9049477F76B37566E3C7DC03D6E495"
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$JULIA_GPG"
gpg --batch --verify julia.tar.gz.asc julia.tar.gz
command -v gpgconf > /dev/null && gpgconf --kill all
rm -rf "$GNUPGHOME" julia.tar.gz.asc julia.sha256

Install and remove the archive.

mkdir -p "$JULIA_PATH"
tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1
rm julia.tar.gz j256sig

And verify it runs.

julia -v

The JSON package is required to run on Nextjournal. Newest JSON.jl uses xparse from newer versions of Parsers.jl, which we can't install. —mpd, 20 Aug 2019

julia -e 'using Pkg; pkg"up; add JSON@0.20.0; pin JSON; build; precompile"'

Build a 'Default' Julia 0.7 Environment

We'll add a number of packages as well as the libraries and support programs required by them. The major packages installed are JuliaPlots along with the GR and PlotlyJS backends, and the DataFrames, CSV, and HDF5 data-handling packages.

Some Julia packages require gcc to compile, so first we'll install that, as well as various required tools and libraries.

apt-get -qq update
apt-get install --no-install-recommends \
  imagemagick libhdf5-dev hdf5-tools mesa-utils \
  build-essential gfortran cmake automake libtool libltdl-dev pkg-config \
  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

Plots needs FFmpeg to create animations, so we'll install a 64-bit static build from an install package we download in the Appendix.

IDIR="/usr/local/ffmpeg"

mkdir -p $IDIR
cd $IDIR

tar -Jxf 
ffmpeg-release-amd64-static.tar.xz
--strip 1 for ex in $IDIR/{ffmpeg,ffmpeg-10bit,ffprobe,qt-faststart}; do ln -s $ex /usr/local/bin/ done

Install packages. Fixing Plots at v0.19.3, the current final 0.7 version. This seems to clear up some other version/dep issues. —mpd, 16 Dec 2018. Added JSON version here, because pinning apparently doesn't work. —mpd, 20 Aug 2019.

using Pkg
pkg"up"
pkg"add SoftGlobalScope DataFrames JLD CSV CSVFiles Netpbm NRRD MeshIO HDF5 MAT FileIO JSExpr JSON@v0.20.0 CSSUtil StatsBase StatsPlots Observables Interact WebSockets HTTP Blink WebIO PlotlyJS PlotlyBase RecipesBase GR Plots#v0.19.3 ImageCore ImageShow ImageMagick Colors BenchmarkTools FixedPointNumbers IJulia"
pkg"build"
pkg"precompile"