9

I am running Ipython notebook hosted on remote AWS EC2 image on RHEL. I am accessing the notebook from local browser using port forwarding between 2 systems which worked perfectly fine for first few days.

Now, I am running into the following error messages when launching notebook:

> [E 20:34:57.072 NotebookApp] 500 PUT /api/contents/HW4/HW4.ipynb (::1)
> 9.14ms referer=http://localhost:8880/notebooks/HW4/HW4.ipynb [W 20:35:10.315 NotebookApp] Replacing stale connection:
> 14cfb1f0-1d03-4a84-818e-d11938db6bd6:57AB20A0DD6A47A5815DE5FA12D0C101
> [W 20:36:34.428 NotebookApp] Replacing stale connection:
> 14cfb1f0-1d03-4a84-818e-d11938db6bd6:57AB20A0DD6A47A5815DE5FA12D0C101
> [I 20:36:57.080 NotebookApp] Saving file at /HW4/HW4.ipynb [E
> 20:36:57.083 NotebookApp] Error while saving file: HW4/HW4.ipynb
> unable to open database file
>     Traceback (most recent call last):
>       File "/home/ec2-user/anaconda3/lib/python3.5/site-packages/notebook/services/contents/filemanager.py",
> line 395, in save
>         self.check_and_sign(nb, path)
>       File "/home/ec2-user/anaconda3/lib/python3.5/site-packages/notebook/services/contents/manager.py",
> line 431, in check_and_sign
>         self.notary.sign(nb)
>       File "/home/ec2-user/anaconda3/lib/python3.5/site-packages/nbformat/sign.py",
> line 263, in sign
>         self.store_signature(signature, nb)
>       File "/home/ec2-user/anaconda3/lib/python3.5/site-packages/nbformat/sign.py",
> line 270, in store_signature
>         (self.algorithm, signature, datetime.utcnow())
>     sqlite3.OperationalError: unable to open database file [W 20:36:57.084 NotebookApp] Unexpected error while saving file:
> HW4/HW4.ipynb unable to open database file [E 20:36:57.084
> NotebookApp] {
>       "Content-Type": "application/json",
>       "Connection": "keep-alive",
>       "Referer": "http://localhost:8880/notebooks/HW4/HW4.ipynb",
>       "Accept-Encoding": "gzip, deflate",
>       "Content-Length": "24540",
>       "Accept-Language": "en-US,en;q=0.5",
>       "Accept": "application/json, text/javascript, */*; q=0.01",
>       "Host": "localhost:8880",
>       "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:49.0) Gecko/20100101 Firefox/49.0",
>       "X-Requested-With": "XMLHttpRequest"
>     } [E 20:36:57.084 NotebookApp] 500 PUT /api/contents/HW4/HW4.ipynb (::1) 40.17ms referer=http://localhost:8880/notebooks/HW4/HW4.ipynb [I
> 20:38:57.096 NotebookApp] Saving file at /HW4/HW4.ipynb [E
> 20:38:57.099 NotebookApp] Error while saving file: HW4/HW4.ipynb
> unable to open database file
>     Traceback (most recent call last):
>       File "/home/ec2-user/anaconda3/lib/python3.5/site-packages/notebook/services/contents/filemanager.py",
> line 395, in save
>         self.check_and_sign(nb, path)
>       File "/home/ec2-user/anaconda3/lib/python3.5/site-packages/notebook/services/contents/manager.py",
> line 431, in check_and_sign
>         self.notary.sign(nb)
>       File "/home/ec2-user/anaconda3/lib/python3.5/site-packages/nbformat/sign.py",
> line 263, in sign
>         self.store_signature(signature, nb)
>       File "/home/ec2-user/anaconda3/lib/python3.5/site-packages/nbformat/sign.py",
> line 270, in store_signature
>         (self.algorithm, signature, datetime.utcnow())
>     sqlite3.OperationalError: unable to open database file [W 20:38:57.099 NotebookApp] Unexpected error while saving file:
> HW4/HW4.ipynb unable to open database file [E 20:38:57.100
> NotebookApp] {
>       "Content-Type": "application/json",
>       "Connection": "keep-alive",
>       "Referer": "http://localhost:8880/notebooks/HW4/HW4.ipynb",
>       "Accept-Encoding": "gzip, deflate",
>       "Content-Length": "24540",
>       "Accept-Language": "en-US,en;q=0.5",
>       "Accept": "application/json, text/javascript, */*; q=0.01",
>       "Host": "localhost:8880",
>       "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:49.0) Gecko/20100101 Firefox/49.0",
>       "X-Requested-With": "XMLHttpRequest"
>     }

I checked the ownership of the anaconda3 folders and the user running Ipython notebook has read/write access to the folders. Should I look into any other configurations

Thomas K
  • 39,200
  • 7
  • 84
  • 86
Abhi
  • 1,153
  • 1
  • 23
  • 38

2 Answers2

12

Given this was posted over a year ago, it's likely been resolved. Posting this answer for the search engines.

Running out of disk space on your /home dir will trigger this error, especially the "it worked before but now doesn't". Given this is an EC2 instance the space may be limited and may fill up, especially if you are doing lots of data analysis.

I experienced the similar error messages on a /home file system limited by quotas after running out of space. Here's the relevant chunk of the exception:

      File "/data/user/jpr/projects/mpdmine/venv/lib/python3.6/site-packages/nbformat/sign.py", line 439, in check_signature
    return self.store.check_signature(signature, self.algorithm)
  File "/data/user/jpr/projects/mpdmine/venv/lib/python3.6/site-packages/nbformat/sign.py", line 239, in check_signature
    (datetime.utcnow(), algorithm, digest),
sqlite3.OperationalError: unable to open database file

The file being opened is not listed in the stack trace but this bug thread provides a hint. The database file is a notebook signature database ~/.local/share/jupyter/nbsignatures.db. The open tries to create journal file and if that fails (due to a full file system) the database open will fail.

You can use strace on your jupyter notebook python process (strace -e open -p ) to see the attempt to open the file.

Fixing the file system full issue should resolve this error.

1

Heh, make sure you didn't reinstall python to resolve a library installation glitch and forgot Jupyter is a python library too while leaving the instance running… Like I did….

RWDJ
  • 734
  • 8
  • 13