Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while saving file: Unable to open database file

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

like image 872
Abhi Avatar asked Oct 25 '16 00:10

Abhi


People also ask

Why can't I open a database on a server?

When you try to open a database that is located on a server, you may receive the following error message: Couldn't use <filename>; file already in use. If doesn't have the Create permissions for the folder in which the database is located, the Microsoft Jet database engine can't create the locking information file.

Why can’t I open a database in access 2000?

When you try to open a database in Microsoft Access 2000 or a later version, you receive the following error message: This problem may occur when you use the Data Access Object (DAO) library to convert a database that you created in Microsoft Access 97 or an earlier version by using the CompactDatabase method.

How to prevent a user from opening the database exclusively?

So if a corresponding file doesn't already exist, a user who doesn't have the Create permissions opens the database exclusively. To prevent this behavior, make sure that all users who open the database have the Read, Write, and Create permissions for the folder in which the database is located.

What is an ODBC error in access?

Describes an issue in which you receive an error message while linking a SQL Database instance table by using ODBC. The issue occurs when you open the linked table in Access. Describes an issue in which an Access linked table that's connected to a SQL Server database returns.


2 Answers

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.

like image 145
John-Paul Robinson Avatar answered Oct 16 '22 07:10

John-Paul Robinson


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….

like image 38
RWDJ Avatar answered Oct 16 '22 09:10

RWDJ