Notebook: OSError: [Errno 2] No such file or directory

Created on 30 Jun 2017  路  8Comments  路  Source: jupyter/notebook

I had to install Jupyter in order to complete Udacity's projects. After following the instructions, and running Jupyter, none of the notebooks would open. This is the log output:

    [W 06:54:04.215 NotebookApp] The signatures database cannot be opened; maybe it is corrupted or encrypted. You may need to rerun your notebooks to ensure that they are trusted to run Javascript. The old signatures database has been renamed to /home/aulon/.local/share/jupyter/nbsignatures.db.bak and a new one has been created.
    [E 06:54:04.218 NotebookApp] Unhandled error in API request
        Traceback (most recent call last):
          File "/home/aulon/.local/lib/python2.7/site-packages/notebook/base/handlers.py", line 516, in wrapper
            result = yield gen.maybe_future(method(self, *args, **kwargs))
          File "/home/aulon/.local/lib/python2.7/site-packages/tornado/gen.py", line 1055, in run
            value = future.result()
          File "/home/aulon/.local/lib/python2.7/site-packages/tornado/concurrent.py", line 238, in result
            raise_exc_info(self._exc_info)
          File "/home/aulon/.local/lib/python2.7/site-packages/tornado/gen.py", line 307, in wrapper
            yielded = next(result)
          File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/handlers.py", line 124, in get
            path=path, type=type, format=format, content=content,
          File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/filemanager.py", line 384, in get
            model = self._notebook_model(path, content=content)
          File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/filemanager.py", line 344, in _notebook_model
            self.mark_trusted_cells(nb, path)
          File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/manager.py", line 456, in mark_trusted_cells
            trusted = self.notary.check_signature(nb)
          File "/home/aulon/.local/lib/python2.7/site-packages/traitlets/traitlets.py", line 556, in __get__
            return self.get(obj, cls)
          File "/home/aulon/.local/lib/python2.7/site-packages/traitlets/traitlets.py", line 535, in get
            value = self._validate(obj, dynamic_default())
          File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/manager.py", line 58, in _notary_default
            return sign.NotebookNotary(parent=self)
          File "/home/aulon/.local/lib/python2.7/site-packages/nbformat/sign.py", line 390, in __init__
            self.store = self.store_factory()
          File "/home/aulon/.local/lib/python2.7/site-packages/nbformat/sign.py", line 338, in factory
            return SQLiteSignatureStore(self.db_file)
          File "/home/aulon/.local/lib/python2.7/site-packages/nbformat/sign.py", line 147, in __init__
            self.db = self._connect_db(db_file)
          File "/home/aulon/.local/lib/python2.7/site-packages/nbformat/sign.py", line 171, in _connect_db
            os.rename(db_file, old_db_location)
        OSError: [Errno 2] No such file or directory
    ...

I searched your issues and found some similar problems here, here, and here, without success.

I installed Anaconda, still the same problem.

Any help is much appreciated.

If I cannot solve this, how can I fully uninstall everything related to jupyter and anaconda? I am using Ubuntu 16.04.

Otherwise, is there any other way I can open a python notebook without jupyter? Maybe Spyder?

Most helpful comment

I notice that all of those files are owned by root; that may well be part of the problem. Try running:

sudo chown -R aulon:aulon ~/.local/share/jupyter

All 8 comments

What does ls ~/.local/share/jupyter give you? Is there anything particular about your filesystem? Is it possible that the disk is full? That can cause all sorts of strange errors.

1171 and #2301 are unrelated - same error message, but coming from another part of the code. ipython/ipython#9163 is an error that we now handle; the error you're seeing is coming from the code to handle that error.

If an sqlite database is corrupt, we try to move it out of the way and replace it, but the error you're getting indicates that the corrupt database doesn't even exist. :-S

selection_060

I included an image. I don't think there is anything in particular, just Ubuntu 16.04. The disk is not full.

Yes, that is the weird part, it is saying the database doesn't exist.

Thank you so much for your answer.

I notice that all of those files are owned by root; that may well be part of the problem. Try running:

sudo chown -R aulon:aulon ~/.local/share/jupyter

You are a master!

I ran that, then opened jupyter-notebook and it finally works!

Thank you very very much!

May I ask what the problem was? Was it because I installed jupyter as root?

I guess that you must have first tried running Jupyter as root, but with $HOME still set to your own home directory. It created all those files, but then you don't have full access when you run Jupyter as your own user.

It's annoying that shows up as an SQLite error, which we then catch and try to handle, rather than a permission error. We can probably improve at least the error message for that.

I see.

Thank you for your time and help. I appreciate it very much!

I'll reopen this for now - we can't exactly fix the underlying problem, but we can fail in a clearer way.

jupyter/nbformat#97 should make this fall back to an in-memory signature database rather than crashing completely.

Was this page helpful?
0 / 5 - 0 ratings