Setting up the build environment for Julia in myBinder

Hi, I am trying to launch a Julia Kernel with a few packages in mybinder. The build fails due to overshooting the memory limit. I want to add the following command line option to the kernel install “–heap-size-hint=1G” to force garbage collection once the specified heap limit is reached.

I tried creating a postbuild file with the following lines of code –

using IJulia
installkernel("Julia heap size limit", "--heap-size-hint=1G")

Is this the right way to do it? If not, what is the correct way to do it?

During the build process, I see the following command being run by the binder to install the kernel. The command does not include the options in the postbuild file.

/bin/sh -c JULIA_PROJECT="" julia -e "using Pkg; Pkg.add(\"IJulia\"); using IJulia;
installkernel(\"Julia\", \"--project=${REPO_DIR}\");" && julia --project=${REPO_DIR} -e 'using Pkg;
Pkg.instantiate(); Pkg.resolve(); pkg"precompile"

Thanks!

postbuild is a shell script that runs after everything else:

There’s no way to pass additional arguments to Julia, so I think your best option at the moment is to setup a minimal Julia environment using the standard repo2docker configuration files, and use postBuild to install the additional Julia packages that are taking up too much memory.

Thanks that helped with pre-compiling the packages I needed except for Javis.

Here is my postBuild code, if someone will be interested!

#!/bin/bash
set -e  # don't allow errors to fail silently
julia --project=. --threads=auto --startup-file=no --heap-size-hint=1G -e '
using Pkg;
Pkg.add("PrettyTables");
Pkg.add("AlgebraicDynamics");
Pkg.add("AlgebraicRewriting");
Pkg.add("Catlab");
Pkg.add("OrdinaryDiffEq");
Pkg.add("Plots");
Pkg.add("SciMLBase");
Pkg.add("LabelledArrays")
exit();
'
1 Like