danielfrg / s3contents

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

Can't start jupyter with empty bucket #63

Closed AgDude closed 3 years ago

AgDude commented 5 years ago

I set up a new deployment with a bucket and prefix. Without a normal file in s3 with this prefix, jupyter fails to start with the following error:

FileNotFoundError: my-bucket/my/prefix

This is related to this issue in s3fs: https://github.com/dask/s3fs/issues/170

It think the right solution is to catch this and drop a file into s3. I uploaded a text file through the AWS console, which allowed jupyter to start.

AbdealiLoKo commented 5 years ago

This is already happening at https://github.com/danielfrg/s3contents/blob/d7e398c7da8836ac7579fa475bded06838e053ea/s3contents/s3_fs.py#L91 in version 0.12.1

And when I do jupyter notebook --log-level DEBUG I can see:

[I 21:31:55.874 NotebookApp] [nb_conda_kernels] enabled, 4 kernels found
[D 21:31:55.929 NotebookApp] S3contents.S3FS: Making dir: `mybucket.emptytemp2/notebooks/.s3keep`
[D 21:31:57.539 NotebookApp] S3contents.S3FS: Listing directory: `mybucket.emptytemp2/notebooks`
[D 21:31:58.561 NotebookApp] S3contents.S3FS: `mybucket.emptytemp2/notebooks` is a directory: True

So, this is already happening. You need to ensure that your prefix has no starting / and ending /

c.S3ContentsManager.bucket = 'mybucket.emptytemp2'
c.S3ContentsManager.prefix = 'notebooks'