pangeo-data / jupyter-earth

Jupyter meets the Earth: combining research use cases in geosciences with technical developments within the Jupyter and Pangeo ecosystems.
https://jupytearth.org
Creative Commons Zero v1.0 Universal
29 stars 6 forks source link

hub image: Add nodejs #130

Closed whyjz closed 2 years ago

whyjz commented 2 years ago

Hi all - can we add nodejs to the JupyterHub image? It is required by jupyterlab-sos, a JupyterLab extension that enables users to activate more than one kernel in a single Notebook.

It seems that an extension can be installed at the user level, so we only need all its dependencies ready in the JupyterHub image? Feel free to edit this PR or chat more about this if I am wrong.

I am also okay if we can install that extension directly (the name is jupyterlab-sos using conda), but there is a conflict between this tool and the cell toolbar because their GUIs overlap each other.

consideRatio commented 2 years ago

Adding things is relatively easy, but maintaining things is more work. Due to that, I'm hesitant to add nodejs unless required.

Based on https://github.com/vatlab/jupyterlab-sos, I conclude that you need NodeJS to build the Python package from its source code, but that you can also install it without nodejs using pip or conda. I tried installing it using pip and that works for me.

Or does it? It installed successfully without errors etc, but I don't know how its supposed to work, so I could not see that it did work as it should or not visually.

image

Do you need to build the extension from source / do you really need nodejs?

consideRatio commented 2 years ago

I looked among my extensions and could not see a cell toolbar extension installed - can you elaborate on the cell toolbar conflict a bit?

whyjz commented 2 years ago

To see how jupyter-sos works and creates conflict with the cell toolbar, I made this Binder example, or you can check out a screenshot from this issue I just submitted to the jupyter-sos team.

I just realized that the cell toolbar isn't an extension; it is a new feature added since jupyterlab 3.3. You can disable that by going to Settings -> Advanced settings.

There are two additional observations:

  1. jupyter-sos works in the Binder example and shows the kernel dropdown menu. However, I installed the package using pip on our JupyterHub, and it doesn't show any menus in the code cells.
  2. Strangely, if I switch to the classic Notebook interface on our Hub, I can see the dropdown menu, and jupyter-sos actually works well.

So I guess there is always a workaround as I can either give up using this tool or continue using this tool with the classic Notebook interface. This conversation is about exploring the best tools and presentations to use as I plan to update the content of the GMT tutorials using Jupyter Book. Nothing is truly necessary -- I am just looking for the best way to make those tutorials. It is not easy though, because one of my needs here is to show Bash and Python code in the same document (for showing both GMT and PyGMT code). Of course, I can just use markdown and perhaps sphinx-inline-tabs for a non-executable page, but now I am experimenting jupyter-sos because I want it to be executable in-situ. People can click "launch binder" and run all cells in the same Notebook, and every tutorial part is done again.

Back to this PR -- Now I am concerned that installing nodejs for the image might not solve those two observations I mentioned above. I don't want this to consume lots of our time and am closing the PR, but feel free to drop in some thoughts any time!