10

Within the past few minutes, I have not been able to access any of the .ipynb files previously created with Python3.4. I go to the subdirectory with these files, enter

ipython3 notebook

When I open a "New" notebook, I get the following error:

Unexpected error while saving file: Untitled1.ipynb database disk image is malformed

I cannot open old notebooks either. I get the error:

An unknown error occurred while loading this notebook. This version can load notebook formats v4 or earlier. See the server log for details.

and within the Terminal, it states

kernels (twice to skip confirmation).
[E 00:30:22.352 NotebookApp] Unhandled error in API request
    Traceback (most recent call last):
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/traitlets/traitlets.py", line 460, in get
        value = obj._trait_values[self.name]
    KeyError: 'db'

How can I fix this?

3
  • Possibly related to this bug: github.com/ipython/ipython/issues/8294 Commented Jan 23, 2016 at 5:57
  • Don't forget to restart! Commented Apr 17, 2018 at 14:07
  • @Crt Tried that Commented Apr 17, 2018 at 16:09

7 Answers 7

16

This won't be the issue for everyone, but I got the below error message because the disk was actually full.

An unknown error occurred while loading this notebook. This version can load notebook formats v4 or earlier. See the server log for details.
Sign up to request clarification or add additional context in comments.

2 Comments

me too, my home directory is full in the Linux server
Yes, you are right. I had the same issue, my C drive was full. Thank you!
11

Search for nbsignatures.db. It should be either here:

~/.ipython/profile_default/security/nbsignatures.db

or here:

 ~/Library/Jupyter/nbsignatures.db

The ~ stands for you home directory.

Move this file this to a temporary directory.

Restart your IPython Notebook server.

1 Comment

Removing the nbsignatures.db file solved the problem, i.e. rm ~/Library/Jupyter/nbsignatures.db
9

remove ~/.ipython/profile_default/history.sqlite

this helps for me.

2 Comments

This did the trick for me, thanks! I was getting a slightly different error than OP, one which did not include a specific version number: "An unknown error occurred while loading this notebook. This version can load notebook formats or earlier. See the server log for details."
This worked for me with Jupyter for vs code extension. It was generating multiple versions of history.sqlite file. extension: v2022.2.1030672458 Mac: OS 10.15.7 Python: 3.9.7. Error message: "The history saving thread hit an unexpected error (OperationalError('attempt to write a readonly database')).History will not be written to the database."
5

Since I couldn't find any of the files mentioned in the other answers, I looked for another solution and found this one to work for me:

I solved this problem by changing the ownership of the ~/.local/share/jupyter directory from root to user.

from https://github.com/ipython/ipython/issues/8997

1 Comment

I had a similar issue. But because the value of the environment variable XDG_DATA_HOME was malformed as /.local/share.
4

In my case, my nbsignatures.db was here, after removing it it can operate normally.

~/.local/share/jupyter/nbsignatures.db

Remember to restart your jupyter notebook server. I restarted several times for this to work.

Comments

0

Non of the other answers helped in my case.

In the end I simply copied my notebook and renamed the copy. The copy didn't have the error.

Comments

0

First run the following in the terminal:

sudo jupyter notebook --allow-root

Then some URL will appear in the terminal, something like:

http://localhost:8888/?token=f2704ecba4c88716337f33e79e13335380e25382603afb80

Finally, copy and paste this URL in a new tab in your browser. Then the jupyter notebook will open in a new tab.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.