简体   繁体   中英

Jupyter notebook SSH Tunneling error “The signatures database cannot be opened”

My university has a Linux machine with a powerful Jupyter running on campus. Here are the steps I use to log in to the remote server through my Windows laptop and run Jupyter notebook on server, that can be edited on my local browser through ssh tunnelling, but it always gives me the same error:

  1. Install anaconda and Jupyter on remote server
  2. Create my environment and activate it
  3. For SSH tunneling, here's how I connect to the remote server on CMD:

     Ssh –L 8000(on my laptop):localhost:8889(on remote server) <MyUserID>@<RemoteServerIP> 
  4. After this it asks for my password and I enter the remote server

  5. To activate anaconda, I use the following command:

     source $HOME/anaconda3/bin/activate 
  6. After entering anaconda, I activate my environment:

     conda activate <env_name> 
  7. After entering the environment, to start jupyter notebook, I type:

     jupyter notebook 

    or

     jupyter notebook --no-browser --port=8889 
  8. Then it displays:

     [I 09:04:06.122 NotebookApp] Writing notebook server cookie secret to /run/user/148037468/jupyter/notebook_cookie_secret [I 09:04:06.881 NotebookApp] Serving notebooks from local directory: <directoryname> [I 09:04:06.881 NotebookApp] The Jupyter Notebook is running at: [I 09:04:06.881 NotebookApp] http://localhost:8889/ [I 09:04:06.881 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [I 09:05:10.507 NotebookApp] 302 GET / (::1) 1.43ms 
  9. Then on my laptop, I type:

     localhost:8000 

    It redirects me to the login page where I successfully see my directory in jupyter notebook and I click on a .ipynb file

  10. After this step it never loads the notebook and displays the following error on the notebook:

    A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.

It gives the following error on the terminal:

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 <directory_name>.local/share/jupyter/nbsignatures.db.bak and a new one has been created.
[W 09:17:35.807 NotebookApp] Failed commiting signatures database to disk. 
You may need to move the database file to a non-networked file system, using config option `NotebookNotary.db_file`. Using in-memory signatures database for the remainder of this session.
[W 09:17:35.811 NotebookApp] Notebook plots1.ipynb is not trusted
[W 09:17:35.881 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20190319090406 (::1) 17.39ms referer=http://localhost:8000/notebooks/plots1.ipynb
[I 09:17:36.430 NotebookApp] Kernel started: 242b529a-5acd-4b5f-8a6d-356947ab30d2
[W 09:18:36.467 NotebookApp] Timeout waiting for kernel_info reply from 242b529a-5acd-4b5f-8a6d-356947ab30d2
/<directory_name>/anaconda3/envs/braingrid/lib/python3.6/site-packages/notebook/base/zmqhandlers.py:284: RuntimeWarning: coroutine 'WebSocketHandler.get' was never awaited
super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs)
[W 09:18:38.276 NotebookApp] Replacing stale connection: 242b529a-5acd-4b5f-8a6d-356947ab30d2:dd09ca5465ba404a886c71b3ca787d6b
[W 09:21:36.370 NotebookApp] Notebook plots1.ipynb is not trusted

[IPKernelApp] ERROR | Failed to open SQLite history /<directory_name>/.ipython/profile_default/history.sqlite (database is locked).
[IPKernelApp] ERROR | History file was moved to /<directory_name>/.ipython/profile_default/history-corrupt.sqlite and a new file created.

And the Jupyter notebook keeps displaying:

"Connecting to terminal"

I don't know how to fix this. I am new to Linux. None of the sudo commands work as I am not the admin/ or have those privileges

This setup is necessary for my thesis.

This might be the problem: your notebook stores signatures ( https://jupyter-notebook.readthedocs.io/en/stable/security.html ) which tell the browser whether to trust any javascript and html on opening the notebook. It stores these in a SQLite database. It seems that if this database file is on an NFS, there can be locking issues:

So it might work to move the file to a local folder on the server, and point NotebookNotary.db_file to there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM