Skip to content

Instantly share code, notes, and snippets.

@timgreen
Last active September 20, 2020 13:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timgreen/e63bfca3742d5a5ee923c02ca394ef40 to your computer and use it in GitHub Desktop.
Save timgreen/e63bfca3742d5a5ee923c02ca394ef40 to your computer and use it in GitHub Desktop.
Scala in Colab
# Based on https://gist.github.com/shadaj/aaac98b690cfeb0cbd891bfe3ce5725d#file-scala-in-colab-template-ipynb
SCALA_VERSION=2.12.8
ALMOND_VERSION=0.3.0+16-548dc10f-SNAPSHOT
[ -f /usr/local/share/jupyter/kernels/scala/kernel.json ] && exit
curl -Lo coursier https://git.io/coursier-cli
chmod +x coursier
./coursier bootstrap \
-r jitpack -r sonatype:snapshots \
-i user -I user:sh.almond:scala-kernel-api_$SCALA_VERSION:$ALMOND_VERSION \
sh.almond:scala-kernel_$SCALA_VERSION:$ALMOND_VERSION \
--sources --default=true \
-o almond-snapshot --embed-files=false
rm coursier
./almond-snapshot --install --global --force
rm almond-snapshot
echo "{
\"language\" : \"scala\",
\"display_name\" : \"Scala\",
\"argv\" : [
\"bash\",
\"-c\",
\"env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libpython3.6m.so:\$LD_PRELOAD java -jar /usr/local/share/jupyter/kernels/scala/launcher.jar --connection-file {connection_file}\"
]
}" > /usr/local/share/jupyter/kernels/scala/kernel.json
echo "Now reload the page to load the notebook in the installed Scala kernel!"
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment