Running CPP and JS Kernel in Deepnote Jupyter Notebook
If you need to work with a language other than Python, the Jupyter ecosystem offers a wide range of other kernels. Deepnote supports a lot of them!
Deepnote Official documentation has instructions on setting up R, Julia, Bash, Scala and Ruby.
I was recently attempting to set up a C++ and Javascript kernels and finally figured out how to make it work. You can read more about Interactive CPP with Cling.
Dockerfile for C++ Kernel
FROM deepnote/python:3.9
RUN apt-get update && \
apt-get install -y g++ libtinfo5
RUN pip install jupyter-console
RUN wget https://root.cern.ch/download/cling/cling_2020-11-05_ROOT-ubuntu18.04.tar.bz2 && \
tar -xf cling_2020-11-05_ROOT-ubuntu18.04.tar.bz2 && \
cd cling_2020-11-05_ROOT-ubuntu18.04/share/cling/Jupyter/kernel && \
pip install -e . && \
jupyter-kernelspec install --user cling-cpp17
ENV PATH="cling_2020-11-05_ROOT-ubuntu18.04/bin:$PATH"
RUN jupyter console --kernel cling-cpp17
ENV DEFAULT_KERNEL_NAME "cling-cpp17"
After the completion of the build, you can execute C++ in the deepnote notebook.
Some things that don’t work in this version, but maybe supported in upcoming versions of the kernel
-
Function redefinitions are not allowed. Issue Link
-
You cannot define more than one function in a block. Issue Link
You can also try to build the latest version and try out these features.
IJavascript is a Javascript kernel for the Jupyter notebook. I used the commands provided on the official repository of the project to create this Dockerfile.
Dockerfile for Javascript Kernel
FROM deepnote/python:3.9
RUN pip install jupyter-console
RUN apt-get update && apt-get install -y g++ libzmq3-dev nodejs npm
RUN npm install -g --unsafe-perm ijavascript
RUN ijsinstall --install=global
RUN jupyter console --kernel javascript
ENV DEFAULT_KERNEL_NAME "javascript"
Follow the same process as above for configuring the environment and you’re ready to run Javascript in Deepnote Notebook.
#development
#jupyter
#docker
#deepnote