2

I am working in JupyterLab within a Managed Notebook instance, accessed through the Vertex AI workbench, as part of a Google Cloud Project. When the instance is created, there are a number of JupyterLab extensions that are installed by default. In the web GUI, one can click the puzzle piece icon and enable/disable all extensions with a single button click. I currently run a post-startup bash script to manage environments and module installations, and I would like to add to this script whatever commands would turn on the existing extensions. My understanding is that I can do this with

# Status of extensions
jupyter labextension list
# Enable/disable some extension
jupyter labextension enable extensionIdentifierHere

However, when I test the enable/disable command in an instance Terminal window, I receive, for example

[Errno 13] Permission denied: '/opt/conda/etc/jupyter/labconfig/page_config.json'

If I try to run this with sudo, I am asked for a password, but have no idea what that would be, given that I just built the environment and didn't set any password.

Any insights on how to set this up, what the command(s) may be, or how else to approach this, would be appreciated.

Potentially relevant:

Not able to install Jupyterlab extensions on GCP AI Platform Notebooks

Unable to sudo to Deep Learning Image

https://jupyterlab.readthedocs.io/en/stable/user/extensions.html#enabling-and-disabling-extensions

Edit 1: Adding more detail in response to answers and comments (@gogasca, @kiranmathew). My goal is to use ipyleaft-based mapping, through the geemap and earthengine-api python modules, within the notebook. If I create a Managed Notebook instance (service account, Networks shared with me, Enable terminal, all other defaults), launch JupyterLab, open the Terminal from the Launcher, and then run a bash script that creates a venv virtual environment, exposes a custom kernel, and performs the installations, I can use geemap and ipywidgets to visualize and modify (e.g., widget sliders that change map properties) Google Earth Engine assets in a Notebook. If I try to replicate this using a Docker image, it seems to break the connection with ipyleaflet, such that when I start the instance and use a Notebook, I have access to the modules (they can be imported) but can't use ipyleaflet to do the visualization. I thought the issue was that I was not properly enabling the extensions, per the "Error displaying widget: model not found" error, addressed in this, this, this, this, etc. -- hence the title of my post. I tried using and modifying @TylerErickson 's Dockerfile that modifies a Google deep learning container and should handle all of this (here), but both the original and modifications break the ipyleaflet connection when booting the Managed Notebook instance from the Docker image.

user6135514
  • 135
  • 9
  • Could you please tell me the name of the extensions you are trying to enable and what you mean by `instance Terminal window` is it Jupyter notebook terminal window or VM instance SSH terminal? Can you tell me how you are accessing the instance terminal window ? – kiran mathew Aug 16 '22 at 12:34
  • @kiranmathew edited post with details. – user6135514 Aug 17 '22 at 10:19

1 Answers1

2

Google Managed Notebooks do not support third-party JL extensions. Most of these extensions require a rebuild of the JupyterLab static assets bundle. This requires root access which our Managed Notebooks do not support.

Untangling this limitation would require a significant change to the permission and security model that Managed Notebooks provides. It would also have implications for the supportability of the product itself since a user could effectively break their Managed Notebook by installing something rogue.

I would suggest to use User Managed Notebooks.

gogasca
  • 9,283
  • 6
  • 80
  • 125
  • I understand why a user wouldn't be permitted to add or remove additional third-party extensions. However, is there a way to programmatically enable the ones that are already installed (puzzle icon > Enable)? Presumably they are accessible, or else the Enable/Disable button wouldn't exist. – user6135514 Aug 16 '22 at 09:46
  • Which ones you would like to be enabled? We can always take user feedback and take it as a FR. – gogasca Aug 17 '22 at 02:01
  • `@gogasca` edited post with details. – user6135514 Aug 17 '22 at 10:20
  • Is there any reason why not to use User Managed? – gogasca Aug 18 '22 at 00:50
  • With User Managed container based JL+containers are customizable, with Google Managed JL runs as a container (not customizable) and kernels run as containers but customizable. We disable the Extension Manager in the next image release – gogasca Aug 18 '22 at 02:34
  • @gogsaca Thanks for your comments. I am exploring the Managed Notebooks for (a) consistency in what is offered as a pipeline-based production environment to colleagues (they can use User Managed in testing), (b) the ability to scale computing resources dynamically, instead of having to manually change the compute capacity, and (c) to avoid having many User Managed notebooks that aren't maintained. I'm interested in the intersection of the Google Managed JL container and the custom Docker images that can be supplied, as related to extensions, but I will post to a new thread for clarity. – user6135514 Aug 18 '22 at 11:43