Step1: install the package
pip install spylon-kernel
Step2: create a kernel spec
This will allow us to select the Scala kernel in the notebook.
python -m spylon_kernel install
Step3: start the jupyter notebook
ipython notebook
And in the notebook we select
New -> spylon-kernel
This will start our Scala kernel.
Step4: testing the notebook
Letโs write some Scala code:
val x = 2
val y = 3
x+y
The output should be something similar to the result in the below image.
As you can see, it also starts the spark components. For this, please make sure you have SPARK_HOME set up.
Now we can even use spark. Letโs test it by creating a data set:
val data = Seq((1,2,3), (4,5,6), (6,7,8), (9,19,10))
val ds = spark.createDataset(data)
ds.show()
This should output a simple data frame:
And we can even use python in this kernel using the command
%python
:
%%python
x=2
print(x)
For more info, you can visit the spylon-kernel Github page.
The notebook with the code above is available here.