Mike Slinn

Polynote - a Polyglot Notebook with First-Class Scala Support

— Draft —

Published 2019-09-07.
Time to read: 1 minutes.

Polynote is a new, polyglot notebook with first-class Scala support, Apache Spark integration, multi-language interoperability including Scala, Python, and SQL, as-you-type autocomplete, and more.

Polynote provides data scientists and machine learning researchers with a notebook environment that allows them the freedom to seamlessly integrate the Netflix JVM-based ML platform — which makes heavy use of Scala — with the Python ecosystem’s popular machine learning and visualization libraries.

https://polynote.org/docs/01-installation.htm.

Scala REPL
$ scala> pip install --upgrade pip

Verify that JAVA_HOME is set.

Scala REPL
$ scala> echo $JAVA_HOME

If no value was printed you should set the environment variable.

Scala REPL
$ scala> export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

That variable should be set in your .bash_profile (Mac) or .profile.

Now install minimal dependencies.

Scala REPL
$ scala> sudo -H pip3 install jep jedi pyspark virtualenv numpy 

You probably also want these dependencies.

Scala REPL
$ scala> sudo -H pip3 install pandas kiwisolver pyparsing cycler matplotlib

Discover the latest version of PolyNote at https://github.com/polynote/polynote/releases and download i.

Scala REPL
$ scala> wget https://github.com/polynote/polynote/releases/download/0.2.12/polynote-dist.tar.gz
$ scala> tar -zxvpf polynote-dist.tar.gz
$ scala> cd polynote/

Polynote uses ivy, not coursier, so the SBT 1.3+ cache is not shared.

To change defaults.

Scala REPL
$scala>  cp config-template.yml config.yml

Now edit config.yml to suit.

Scala REPL
$ scala> echo "alias polynote=’sudo -H /opt/polynote/polynote’" >> ~/.bash_aliases
$ scala> source ~/.bash_aliases

If you want to run Spark examples, install Spark and set SPARK_HOME.

You can import existing Jupyter notebooks into Polynote – simply drag-and-drop the notebook file from your computer onto the Notebooks panel.

Run PolyNote.

Scala REPL
$ scala> polynote

Go to https://localhost:8192, press Ctrl-C to stop.

Python is currently the major non-JVM-based language used with Polynote. Polynote uses jep for Python/Scala interoperability. Read about how Jep works.


* indicates a required field.

Please select the following to receive Mike Slinn’s newsletter:

You can unsubscribe at any time by clicking the link in the footer of emails.

Mike Slinn uses Mailchimp as his marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp’s privacy practices.