aiidateam / aiida-project

AiiDA project manager
Other
3 stars 7 forks source link

✨ NEW: Add support for Jupyter kernel installation #5

Open mbercx opened 1 year ago

mbercx commented 1 year ago

Users often want to use Jupyter notebooks to run AiiDA calculations or perform analysis. It's possible to install jupyterlab in the Python environment where AiiDA is installed, but there are advantages to having one centralised Jupyter server running that can access all aiida-project environments:

  1. Only one active server needed, using less memory and other resources.
  2. Only have to configure the server once.
  3. Having access to all AiiDA projects is useful in case there is interaction between the projects.

IDE's like VSCode can make this really simple as well, but often also use quite a bit of resources to make this happen. Some tools like jupytext for writing notebooks in Markdown are also not supported quite as well in VSCode.

Typically you can install a kernel of a certain environment quite easily, see:

https://ipython.readthedocs.io/en/latest/install/kernel_install.html

However, to use a separated environment for AiiDA properly, You also have to set the env key in the kernel.json, e.g.:

{
 "argv": [
  "/home/aiida/.virtualenvs/aiida-super/bin/python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "aiida-super",
 "language": "python",
 "env": {"AIIDA_PATH": "/home/aiida/envs/aiida-super"}
}

Moreover, providing a user-friendly CLI for doing these kind of kernel installs will also make the process less painful and error-prone.