Install common JupyterLab extension and custom kernel in JupyterHub

I have a JupyterLab extension which i want to install by default for all users in the JupyterLab, so whenever a new user is added they get that extension by default.

Also i need to provide a common custom kernel to all the users, how can i achieve that

Tried checking in the docs with not much sucess

Installing common packages depends on how your user environment is set up, and it differs if you are using containers or a shared filesystem, etc. So the first question is: what spawner are you using, and are you using the zero-to-jupyterhub helm chart or the-littlest-jupyterhub? Answering that will help give a more concrete answer.

In general, if it’s a JupyterLab extension, it’s one step: install the extension package in the Python environment where singleuser servers run. Once you do that, it should be available to all your users.

For the common custom kernel, it is similar:

  1. create the kernel environment (e.g. python -m venv or conda create), and
  2. ‘register’ the kernel so it will be found in the server environment with /path/to/env/bin/python -m ipykernel install --name some-descriptive-name --system (or --prefix /path/to/user/env)

The main thing is that the kernelspec should be installed in one of the paths under data in the output of jupyter --path (/usr/local is always searched, as is sys.prefix)

Exactly how that is done will depend on how you create the user environment.

More general info in the docs, and specific info for zero-to-jupyerhub or the-littlest-jupyterhub.