Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jupyter-fs icons don't appear in the left side of the jupyterlab UI #220

Open
gregorycottone opened this issue Dec 18, 2024 · 5 comments
Open

Comments

@gregorycottone
Copy link

gregorycottone commented Dec 18, 2024

Hello,

I'm trying to use jupyter-fs to browse to my S3 buckets from jupyterlab environment.

jupyterlab == 4.95.3
jupyter-fs == 1.0.0
jupyter_server == 2.4.0

I have created a Docker image with jupyterlab and other packages like jupyter-fs.

This is the code I set in the jupyter_server_config.py file:

# Configuration for jupyter-fs
c.ServerApp.contents_manager_class = "jupyterfs.metamanager.MetaManager"
c.ServerApp.jpserver_extensions = {"jupyterfs.extension": True}

After building the image and accessing the jupyterlab environement, I can confirm that jupyter-fs extension is correctly installed:

jupyter labextension list --verbose

(base) [user/ ~]$ jupyter labextension list --verbose
JupyterLab v4.3.2
/opt/conda/share/jupyter/labextensions
        jupyter-fs v1.0.0 enabled OK (python, jupyter-fs)

Then in the advanced settings editor I simply paste the code example of the jupyter-fs repository and I save the new configuration:

{
  "resources": [
    {
      "name": "root at test dir",
      "url": "osfs:///Users/foo/test"
    },
    {
      "name": "s3 test bucket",
      "url": "s3://test"
    },
    {
      "name": "s3 test key",
      "url": "s3://test-2/prefix/",
      "defaultWritable": false
    }
  ]
}

But the file system icons that should appear on the left don't show up:

image

I also noted that when I save the new settings configuration and I check the Network section in the browser console, I get the following information:

Request URL: https://xxxxxxxxxxx/user/xxxxxxx/jupyterfs/resources?1734529374043
Request Method: POST
Status Code: 500 Internal Server Error

request body:

{
"resources":[
{
"name":"root at test dir",
"url":"osfs:///Users/foo/test",
"auth":"ask",
"defaultWritable":true
},
{
"name":"s3 test bucket",
"url":"s3://test",
"auth":"ask",
"defaultWritable":true
},
{
"name":"s3 test key",
"url":"s3://test-2/prefix/",
"defaultWritable":false,
"auth":"ask"
}
],
"options":{
"cache":true,
"verbose":false,
"_addServerside":true
}
}

response body:

{
    "message": "Unhandled error",
    "reason": null,
    "traceback": "Traceback (most recent call last):\n  File \"/opt/conda/lib/python3.10/site-packages/tornado/web.py\", line 1790, in _execute\n    result = await result\n  File \"/opt/conda/lib/python3.10/site-packages/jupyterfs/metamanager.py\", line 257, in post\n    self.finish(json.dumps(self.contents_manager.initResource(*resources, options=options)))\nAttributeError: 'JupytextContentsManager' object has no attribute 'initResource'\n"
}
@timkpaine
Copy link
Collaborator

timkpaine commented Dec 18, 2024

None of those mounts look real, what happens if you use just one osfs with a real path?

@gregorycottone
Copy link
Author

Thank you for the answer, but it seems that it doesn't work even putting a correct S3 bucket path:

{
  "resources": [
    {
            "name": "s3-test-bucket",
            "url": "s3://my-test-bucket-blablabla/"
    }
  ]
}

Note that with the following Python code running in a notebook in the same Jupyterlab environment I can list all the folders under the bucket above:

from fs import open_fs
s3fs = open_fs('s3://my-test-bucket-blablabla/')
s3fs.listdir('/')

@timkpaine
Copy link
Collaborator

what happens if you use just one osfs with a real path?

@gregorycottone
Copy link
Author

Hello Tim, by just setting:

"resources": [
        {
            "name": "s3-test-bucket",
            "url": "osfs://"
        }
    ]

I still have the same issue.

If I inspect the networking section from the browser console I see the following:

Request URL: https://xxxxxxxxx.com/user/xxxxxxxxxx/jupyterfs/resources?1734612013913
Request Method: POST
Status Code: 500 Internal Server Error

Request body:

{"resources":[{"name":"s3-test-bucket","url":"osfs://","auth":"ask","defaultWritable":true}],"options":{"cache":true,"verbose":false,"writtenVersion":"1.0.0","_addServerside":true}}

Response body:

{
    "message": "Unhandled error",
    "reason": null,
    "traceback": "Traceback (most recent call last):\n  File \"/opt/conda/lib/python3.10/site-packages/tornado/web.py\", line 1790, in _execute\n    result = await result\n  File \"/opt/conda/lib/python3.10/site-packages/jupyterfs/metamanager.py\", line 257, in post\n    self.finish(json.dumps(self.contents_manager.initResource(*resources, options=options)))\nAttributeError: 'JupytextContentsManager' object has no attribute 'initResource'\n"
}

Olso note that if I run the following code snippet in the same JupyterLab environment:

from fs import open_fs
s3fs = open_fs('osfs://')
print(s3fs)

I get this output:

<osfs '/home/jovyan'>

@timkpaine
Copy link
Collaborator

Looks like you're using Jupytext as your contents manager, not jupyter-fs. Even though you've set it in jupyter_server_config, it is probably being overridden by a file nearby, perhaps a json config file in that directory or a sub directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants