Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [Errno 2] No such file or directory #2621

Closed
aulon opened this issue Jun 30, 2017 · 8 comments
Closed

OSError: [Errno 2] No such file or directory #2621

aulon opened this issue Jun 30, 2017 · 8 comments

Comments

@aulon
Copy link

aulon commented Jun 30, 2017

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?

@takluyver
Copy link
Member

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

@aulon
Copy link
Author

aulon commented Jul 3, 2017

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.

@takluyver
Copy link
Member

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

@aulon
Copy link
Author

aulon commented Jul 3, 2017

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?

@takluyver
Copy link
Member

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.

@aulon
Copy link
Author

aulon commented Jul 3, 2017

I see.

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

@aulon aulon closed this as completed Jul 3, 2017
@takluyver
Copy link
Member

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

@takluyver takluyver reopened this Jul 3, 2017
@takluyver takluyver added this to the Not Notebook milestone Jul 4, 2017
takluyver added a commit to takluyver/nbformat that referenced this issue Jul 4, 2017
In some circumstances, we can fail to connect to the SQLite database
without creating the file. Then attempting to move it to the backup location
fails as well. This catches that error and falls back to using an
in-memory database for signatures.

Closes jupyter/notebook#2621
@takluyver
Copy link
Member

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants