【发布时间】:2019-08-10 06:27:52
【问题描述】:
我的大学有一台 Linux 机器,校园里运行着强大的 Jupyter。以下是我通过 Windows 笔记本电脑登录远程服务器并在服务器上运行 Jupyter notebook 的步骤,可以通过 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 文件
-
在这一步之后,它永远不会加载笔记本并在笔记本上显示以下错误:
无法建立到笔记本服务器的连接。笔记本电脑将继续尝试重新连接。检查您的网络连接或笔记本服务器配置。
它在终端上给出以下错误:
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 命令都不起作用,因为我不是管理员/ 或拥有这些权限
我的论文需要这个设置。
【问题讨论】:
-
您能否编辑帖子并确保它具有换行符、格式等以使其更具可读性
标签: linux ssh anaconda jupyter-notebook ssh-tunnel