I installed a software called "Polynote" like Jupyter Notebook that can use both Scala and Python at the same time.
Instead of making Python notes and Scala notes, you can mix Python and Scala in one note!
Polynote official website Polynote | The polyglot Scala notebook
Introductory article on Polynote Netflix’s Polynote is a New Open Source Framework to Build Better Data Science Notebooks | by Jesus Rodriguez | DataSeries | Aug, 2020 | Medium
Installation procedure
Install Python3. This time I installed 3.8.1 with pyenv.
When Python was installed normally with pyenv, the following error occurred in pip install -r ./requirements.txt
when installing Polynote itself after that. It seems that building the package jep
that Polynote depends on fails.
/usr/bin/ld: /home/xxxx/.pyenv/versions/3.8.1/lib/libpython3.8.a(floatobject.o): relocation R_X86_64_PC32 against symbol `PyFloat_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
I don't understand the reason, but I was able to avoid the error by installing with the option attached to pyenv as follows.
$ PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -v --force 3.8.1
Install Java 11.
The official documentation says Java supports 8 and 11, but 11 is good.
At first I ran at 8. However, although it starts, I get a lot of error messages both on the command line and in the browser, especially Scala's collection framework is useless. ʻAbstractMethodError and
NullPointerException` occur frequently.
$ wget 'https://github.com/polynote/polynote/releases/download/0.3.11/polynote-dist.tar.gz'
$ tar xvzf polynote-dist.tar.gz
$ cd polynote
$ pip install -r ./requirements.txt
Install the package as you like.
$ pip install matplotlib
$ python ./polynote.py
[INFO] Loading configuration from config.yml
[INFO] Loaded configuration: PolynoteConfig(Listen(8192,127.0.0.1),KernelConfig(None,None),Storage(tmp,notebooks,Map(),Wal(false)),List(),List(),Map(),None,Behavior(true,Always,List()),Security(None,None),UI(/),Credentials(None),Map(),StaticConfig(None,None))
[WARN] Polynote allows arbitrary remote code execution, which is necessary for a notebook tool to function.
| While we'll try to improve safety by adding security measures, it will never be completely safe to
| run Polynote on your personal computer. For example:
|
| - It's possible that other websites you visit could use Polynote as an attack vector. Browsing the web
| while running Polynote is unsafe.
| - It's possible that remote attackers could use Polynote as an attack vector. Running Polynote on a
| computer that's accessible from the internet is unsafe.
| - Even running Polynote inside a container doesn't guarantee safety, as there will always be
| privilege escalation and container escape vulnerabilities which an attacker could leverage.
|
| Please be diligent about checking for new releases, as they could contain fixes for critical security
| flaws.
|
| Please be mindful of the security issues that Polynote causes; consult your company's security team
| before running Polynote. You are solely responsible for any breach, loss, or damage caused by running
| this software insecurely.
[INFO]
| _____ _ _
| | __ \ | | | |
| | |__) |__ | |_ _ _ __ ___ | |_ ___
| | ___/ _ \| | | | | '_ \ / _ \| __/ _ \
| | | | (_) | | |_| | | | | (_) | || __/
| |_| \___/|_|\__, |_| |_|\___/ \__\___|
| __/ |
| |___/
|
[INFO] Polynote version 0.3.11
[INFO] Server listening on http://localhost:8192/
If you access port 8192 with a browser, the screen will look a little different from Jupyter Notebook, and you can create notes.
The following is an execution example. You can mix Python and Scala.