Just like Python, ScalaPy can be used inside Jupyter notebooks to build experiments in an interactive environment. With Almond, a Scala kernel implementation, using ScalaPy only requires a little configuration to be used!
If you want to get set up in a hosted environment, take a look at the example notebook on Google Colab. To set up a local instance, read on!
First, we must modify the default Scala kernel definition to load Python native libraries.
jupyter/kernels/scala/kernel.json file, replace the contents with
Make sure to replace
/usr/lib/x86_64-linux-gnu/libpython3.6m.so with the path to your Python native library and ajust the
SCALAPY_PYTHON_LIBRARY appropriately if you want to use a different version of Python 3.
python3-config --prefix will give you the folder containing your installation's native libraries.
ScalaPy on the JVM contains with all the logic to load native libraries built-in, so you can import ScalaPy and start using it as usual!