Connect Google colab to a runtime on a Google Compute Engine instance(将Google CoLab连接到Google Compute Engine实例上的运行时)
本文介绍了将Google CoLab连接到Google Compute Engine实例上的运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将Google CoLab上的Jupyter笔记本连接到GCP EC2实例上的运行时。我遵循此CoLab文档说明Link
采取的步骤:
在本地设置Jupyter服务器
pip install jupyter_http_over_ws && jupyter serverextension enable --py jupyter_http_over_ws jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
在GCP上创建并启动EC2实例
SSH进入EC2实例并使用转发本地端口:
gcloud beta compute ssh --zone "europe-west2-c" "<ec2-instance-name>" --project "<project-name>" -- -L 8888:localhost:8888
尝试转发端口的错误消息:
bind [127.0.0.1]:8888: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 8888
Could not request local forwarding.
我还尝试将EC2实例直接连接到CoLab,但无法成功。对于最后一步,我假设将jupyter url复制到CoLab本地运行时。我如何修复此问题?
推荐答案
我算出来了。
步骤:
启动实例
连接到实例并将远程实例上的端口转发到本地计算机
gcloud beta compute ssh --zone "<zone>" "<ec2-instance-name>" --project "<project-name>" -- -L 8888:localhost:8888
安装jupyter笔记本和jupyter_http_over_ws(如果未在 远程实例已经。
然后启用
jupyter_http_over_ws
:jupyter serverextension enable --py jupyter_http_over_ws
在远程实例上启动Jupyter服务器
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
将服务器URL复制到CoLab
这篇关于将Google CoLab连接到Google Compute Engine实例上的运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:将Google CoLab连接到Google Compute Engine实例上的运行时


基础教程推荐
猜你喜欢
- 如何在Python中绘制多元函数? 2022-01-01
- 使 Python 脚本在 Windows 上运行而不指定“.py";延期 2022-01-01
- 将 YAML 文件转换为 python dict 2022-01-01
- 如何在 Python 中检测文件是否为二进制(非文本)文 2022-01-01
- 使用 Google App Engine (Python) 将文件上传到 Google Cloud Storage 2022-01-01
- 症状类型错误:无法确定关系的真值 2022-01-01
- Python 的 List 是如何实现的? 2022-01-01
- 使用Python匹配Stata加权xtil命令的确定方法? 2022-01-01
- 哪些 Python 包提供独立的事件系统? 2022-01-01
- 合并具有多索引的两个数据帧 2022-01-01