Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Created June 13, 2023 17:11
Show Gist options
  • Select an option

  • Save MohamedElashri/7ed51895a157adecad6f9ec9284f77b5 to your computer and use it in GitHub Desktop.

Select an option

Save MohamedElashri/7ed51895a157adecad6f9ec9284f77b5 to your computer and use it in GitHub Desktop.
Add Julia runtime to google colab

Add this cell code at the beginning and run it

%%shell
set -e

#---------------------------------------------------#
JULIA_VERSION="1.6.0" # any version ≥ 0.7.0
JULIA_PACKAGES="IJulia BenchmarkTools Plots" # add julia package you want to use here
JULIA_PACKAGES_IF_GPU="CUDA" # or CuArrays for older Julia versions
JULIA_NUM_THREADS=2
#---------------------------------------------------#

…  echo "Installing IJulia kernel..."
  julia -e 'using IJulia; IJulia.installkernel("julia", env=Dict(
      "JULIA_NUM_THREADS"=>"'"$JULIA_NUM_THREADS"'"))'
  KERNEL_DIR=`julia -e "using IJulia; print(IJulia.kerneldir())"`
  KERNEL_NAME=`ls -d "$KERNEL_DIR"/julia*`
  mv -f $KERNEL_NAME "$KERNEL_DIR"/julia  

  echo ''
  echo "Success! Please reload this page and jump to the next section."
fi

Then choose julia run time from edit then Notebook Settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment