Jupyter Notebook
If you are coding in Python or working in data science, you most probably heard of or are using Jupyter Notebook, and/or Jupyterlab. I also have my setup and would like to document what I have done.
Preconditions
I have a normal Debian Server. Depending on your use case, some computing power may be appropriate. But that’s it.
Packages
Mainly, two packages are important for me: ffmpeg
and imagemagick
. Both are not required but nice for Sagemath as soon as you want to create some images.
Install Mamba
Conda is a very powerful manager for Python Environments. I usually prefer venv
because it is built-in to Python and a bit more flexible for development (particularly with the location of environments), but I love Conda for Jupyter Notebook where all the environments are in one place anyways.
Instead of Conda itself I will use Mamba which is a C++ implementation of Conda. It is essentially a drop-in replacement and much faster than Conda, particularly when downloading many packages (looking at you, Sagemath).
Installation is quite straight-forward. I am using the root
user because I want my base images to be readable but immutable by the user that will run Jupyter Notebook.
|
|
And that’s it!
Install Jupyter Notebook
Separating things is always good, so we will create an own environment for that. Again, this will be done with the root
user.
|
|
Define some server settings
This now has to be done with the user that will be running the Jupyter Notebook. It’s chris
in my case, it may be different for you.
|
|
The file ~/.jupyter/jupyter_server_config.py
was created. Edit it and update or add the following lines:
|
|
Define a password
Without a password, you can only login with a token which is not nice for a server application. Setting a password is straight forward (again as user chris
):
|
|
Done! The password will be written (in an encrypted form) to ~/.jupyter/jupyter_server_config.json
.
R Kernel
I have to work with the R language at university. Installing this was mostly straight-forward.
|
|
Installing the Jupyter Kernel worked from the R
console, as user chris
:
|
|
Sagemath Kernel
My preferred Maths Programming Language. Also the reason to use Mamba over Conda. Run as root:
|
|
Installing the kernel, as user chris
:
|
|
Installing the kernel did raise an error for me, because the Sagemath kernel here is incomplete. Still, everything worked out and the kernel was available in Jupyter. As a cosmetic change, I just required the logo images. I just copied them there; knowing that this is not really how it should be done but it works out. For reference, I used logo-64x64.png and logo.svg and placed them in the ~/.local/share/jupyter/kernels/sagemath/
directory.
Missing: Octave (Matlab)
We are also using Octave quite some time. I did not yet install the kernel for it but I may do so in the future and maybe even update the post then. Let’s see. If you desire that, send me a message - this may motivate me to write this part too.