ipython: DatabaseError: database disk image is malformed
After shutdown (ctrl+c) and restart of ipython notebook I get this error:
[E 17:26:06.417 NotebookApp] Unhandled error in API request
Traceback (most recent call last):
File "/home/ml/anaconda2/lib/python2.7/site-packages/notebook/base/handlers.py", line 458, in wrapper
result = yield gen.maybe_future(method(self, *args, **kwargs))
File "/home/ml/anaconda2/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run
value = future.result()
File "/home/ml/anaconda2/lib/python2.7/site-packages/tornado/concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "/home/ml/anaconda2/lib/python2.7/site-packages/tornado/gen.py", line 282, in wrapper
yielded = next(result)
File "/home/ml/anaconda2/lib/python2.7/site-packages/notebook/services/contents/handlers.py", line 124, in get
path=path, type=type, format=format, content=content,
File "/home/ml/anaconda2/lib/python2.7/site-packages/notebook/services/contents/filemanager.py", line 354, in get
model = self._notebook_model(path, content=content)
File "/home/ml/anaconda2/lib/python2.7/site-packages/notebook/services/contents/filemanager.py", line 314, in _notebook_model
self.mark_trusted_cells(nb, path)
File "/home/ml/anaconda2/lib/python2.7/site-packages/notebook/services/contents/manager.py", line 447, in mark_trusted_cells
trusted = self.notary.check_signature(nb)
File "/home/ml/anaconda2/lib/python2.7/site-packages/nbformat/sign.py", line 220, in check_signature
if self.db is None:
File "/home/ml/anaconda2/lib/python2.7/site-packages/traitlets/traitlets.py", line 529, in __get__
return self.get(obj, cls)
File "/home/ml/anaconda2/lib/python2.7/site-packages/traitlets/traitlets.py", line 508, in get
value = self._validate(obj, dynamic_default())
File "/home/ml/anaconda2/lib/python2.7/site-packages/nbformat/sign.py", line 127, in _db_default
self.init_db(db)
File "/home/ml/anaconda2/lib/python2.7/site-packages/nbformat/sign.py", line 139, in init_db
)""")
DatabaseError: database disk image is malformed
The following similar issues did not help in solving: https://github.com/ipython/ipython/issues/2097 https://github.com/ipython/ipython/issues/7795 https://github.com/ipython/ipython/issues/8294 https://github.com/ipython/ipython/issues/8997
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 4
- Comments: 21 (5 by maintainers)
Solved by
rm ~/.local/share/jupyter/nbsignatures.db– ipython/jupyter are trashing the hd a bit too much imho, if nobody knows anymore where all the db’s are located…The location is different on osx. Run jupyter --data-dir to see where that file lives.
I solved this issue by going into .ipython folder and removing the corrupted database, which turned out to be ipython’s history.sql. I think what may have happened is I was doing a conda update --all while jupyter lab was up, and maybe that corrupted the database since there was an active ipython kernel being used.
@ctivanovich solution of deleting
history.sqliteworked for me. References