Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Recently my jupyter notebooks have been encountering a
Unexpected error while saving file: ... database is locked
I've been running these things for years and only in the last two weeks has this problem started occuring. Nothing has changed in my anaconda python environment. The notebooks are stored on a network drive on my windows pc. I launch
jupyter notebook
at the command line from inside that network drive. Nothing I can do otherwise than kill the jupyter notebook process and reload everything. A collegue is facing similar situation.
Very scant information on this. The closest thing I've found is a reference here
https://groups.google.com/g/jupyter/c/47GzvUm0jZA/m/o3jJagzEAgAJ
The 'database is locked' error probably comes from an SQLite database
we use to store notebook signatures as part of the trust mechanism.
This usually arises because the database file is on an NFS filesystem.
The default location on Linux is
~/.local/share/jupyter/nbsignatures.db .
You can put the file
somewhere else by configuring NotebookNotary.db_file . You can also
set it to the special value ':memory:' to store the database in memory
but if you do this, restarting the notebook server will lose the signatures, so all notebooks will be untrusted, meaning HTML output
won't show up until you re-run them.
I haven't been able to find this NotebookNotary file on my windows to figure out what the configuration says. I also don't have any good debugging ideas here.
=============
I found my jupyter config file. It doesn't say an explicit path to where the file is stored.
#------------------------------------------------------------------------------
# NotebookNotary(LoggingConfigurable) configuration
#------------------------------------------------------------------------------
## A class for computing and verifying notebook signatures.
## The hashing algorithm used to sign notebooks.
#c.NotebookNotary.algorithm = 'sha256'
## The sqlite file in which to store notebook signatures. By default, this will
# be in your Jupyter data directory. You can set it to ':memory:' to disable
# sqlite writing to the filesystem.
#c.NotebookNotary.db_file = ''
## The secret key with which notebooks are signed.
#c.NotebookNotary.secret = b''
## The file where the secret key is stored.
#c.NotebookNotary.secret_file = ''
## A callable returning the storage backend for notebook signatures. The default
# uses an SQLite database.
#c.NotebookNotary.store_factory = traitlets.Undefined
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.