danielfrg / s3contents

Jupyter Notebooks in S3 - Jupyter Contents Manager implementation
Apache License 2.0
248 stars 88 forks source link

Issues while applying S3Contents to jupyterhub/minimal-notebook docker image. #159

Closed nlhnt closed 10 months ago

nlhnt commented 1 year ago

Hello, I tried applying this package to my jupyterhub kubernetes instance.
Unfortunately it doesn't seem to work with https://hub.docker.com/r/jupyter/minimal-notebook.
After modyfing the image (I installed s3contents and boto3 and added the config file) the trace raises the following error:
[W 2023-04-01 20:55:13.204 ServerApp] nbclassic | error linking extension: The 'contents_manager_class' trait of a ServerApp instance expected a subclass of 'jupyter_server.services.contents.manager.ContentsManager', not the S3ContentsManager S3ContentsManager.

My jupyter_notebook_config.py:

# Configuration file for jupyter-notebook.
from s3contents import S3ContentsManager
c = get_config()  #noqa

# Tell Jupyter to use S3ContentsManager
c.ServerApp.contents_manager_class = S3ContentsManager

c.S3ContentsManager.access_key_id = "AKI**************TGF"
c.S3ContentsManager.secret_access_key = "zjL**********/**********5"
c.S3ContentsManager.endpoint_url = "https://s3.amazonaws.com"
c.S3ContentsManager.prefix = "notebooks/test"
c.S3ContentsManager.bucket = "my*******"
pjacobsen-utilimarc commented 10 months ago

@nlhnt Did you ever find a way around this?

BlessedDisco commented 10 months ago

@pjacobsen-utilimarc, I get the same error for s3contents versions 0.11.0 and higher when using the docker images of jupyter datascience-notebook (for version 7.0.6 and version 6.5.4). I do not get the error when using version 0.10.1 of s3contents.

This prevents me from updating Jupyter notebook to version 7, since this is only supported since s3contents version 0.11.0.

The error for Jupyter notbeook 7.0.6 combined with s3contents 0.11.1:

[W 2023-12-13 16:32:06.081 ServerApp] nbclassic | error linking extension: The 'contents_manager_class' trait of a ServerApp instance expected a subclass of 'jupyter_server.services.contents.manager.ContentsManager', not the S3ContentsManager S3ContentsManager.
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 342, in link_extension
        extension.link_all_points(self.serverapp)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 224, in link_all_points
        self.link_point(point_name, serverapp)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 214, in link_point
        point.link(serverapp)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 136, in link
        linker(serverapp)
      File "/opt/conda/lib/python3.11/site-packages/nbclassic/notebookapp.py", line 219, in _link_jupyter_server_extension
        return super()._link_jupyter_server_extension(serverapp)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 405, in _link_jupyter_server_extension
        self.serverapp.update_config(self.config)
      File "/opt/conda/lib/python3.11/site-packages/traitlets/config/configurable.py", line 241, in update_config
        self._load_config(config)
      File "/opt/conda/lib/python3.11/site-packages/traitlets/config/configurable.py", line 190, in _load_config
        setattr(self, name, deepcopy(config_value))
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 748, in __set__
        self.set(obj, value)
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 722, in set
        new_value = self._validate(obj, value)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 754, in _validate
        value = self.validate(obj, value)
                ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 2161, in validate
        self.error(obj, value)
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 858, in error
        raise TraitError(e)
    traitlets.traitlets.TraitError: The 'contents_manager_class' trait of a ServerApp instance expected a subclass of 'jupyter_server.services.contents.manager.ContentsManager', not the S3ContentsManager S3ContentsManager.
[I 2023-12-13 16:32:06.082 ServerApp] nbdime | extension was successfully linked.
[W 2023-12-13 16:32:06.085 ServerApp] notebook | error linking extension: The 'contents_manager_class' trait of a ServerApp instance expected a subclass of 'jupyter_server.services.contents.manager.ContentsManager', not the S3ContentsManager S3ContentsManager.
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 342, in link_extension
        extension.link_all_points(self.serverapp)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 224, in link_all_points
        self.link_point(point_name, serverapp)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 214, in link_point
        point.link(serverapp)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 136, in link
        linker(serverapp)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 405, in _link_jupyter_server_extension
        self.serverapp.update_config(self.config)
      File "/opt/conda/lib/python3.11/site-packages/traitlets/config/configurable.py", line 241, in update_config
        self._load_config(config)
      File "/opt/conda/lib/python3.11/site-packages/traitlets/config/configurable.py", line 190, in _load_config
        setattr(self, name, deepcopy(config_value))
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 748, in __set__
        self.set(obj, value)
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 722, in set
        new_value = self._validate(obj, value)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 754, in _validate
        value = self.validate(obj, value)
                ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 2161, in validate
        self.error(obj, value)
      File "/opt/conda/lib/python3.11/site-packages/traitlets/traitlets.py", line 858, in error
        raise TraitError(e)
    traitlets.traitlets.TraitError: The 'contents_manager_class' trait of a ServerApp instance expected a subclass of 'jupyter_server.services.contents.manager.ContentsManager', not the S3ContentsManager S3ContentsManager.
pjacobsen-utilimarc commented 10 months ago

@BlessedDisco I believe I got the fix in here https://github.com/danielfrg/s3contents/pull/184 it just hasn't been tagged or pushed to pypi yet

BlessedDisco commented 10 months ago

@pjacobsen-utilimarc thanks for the fix. I have tested it by cloning your project and locally building the s3contents package and I can confirm that your fix solves this issue for me.

danielfrg commented 10 months ago

I just uploaded 0.11.2 that includes the fix. Thanks all!