我的大学有一台 Linux 机器,校园里运行着强大的 Jupyter。以下是我通过 Windows 笔记本电脑登录远程服务器并在服务器上运行 Jupyter 笔记本的步骤,可以通过 ssh 隧道在我的本地浏览器上进行编辑,但它总是给我同样的错误:
- 在远程服务器上安装 anaconda 和 Jupyter
- 创建我的环境并激活它
对于 SSH 隧道,这是我在 CMD 上连接到远程服务器的方式:
Ssh –L 8000(on my laptop):localhost:8889(on remote server) <MyUserID>@<RemoteServerIP>之后它会询问我的密码,然后我进入远程服务器
要激活 anaconda,我使用以下命令:
source $HOME/anaconda3/bin/activate进入anaconda后,我激活我的环境:
conda activate <env_name>进入环境后,要启动 jupyter notebook,我输入:
jupyter notebook或
jupyter notebook --no-browser --port=8889然后显示:
[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然后在我的笔记本电脑上,我输入:
localhost:8000它将我重定向到登录页面,在那里我成功地在 jupyter notebook 中看到了我的目录,然后我点击了一个 .ipynb 文件
完成此步骤后,它不再加载笔记本并在笔记本上显示以下错误:
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.
它在终端上给出以下错误:
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.
并且 Jupyter notebook 不断显示:
"Connecting to terminal"
我不知道如何解决这个问题。我是 Linux 新手。所有 sudo 命令都不起作用,因为我不是管理员/或没有这些权限
这个设置对于我的论文是必要的。
请您参考如下方法:
这可能是问题所在:您的笔记本存储签名 ( https://jupyter-notebook.readthedocs.io/en/stable/security.html ),它告诉浏览器在打开笔记本时是否信任任何 javascript 和 html。它将这些存储在 SQLite 数据库中。似乎如果这个数据库文件在 NFS 上,可能会出现锁定问题:
因此,将文件移动到服务器上的本地文件夹并将 NotebookNotary.db_file 指向那里可能会奏效。




