获取 VS Code Python 扩展以连接到在远程 AWS EMR 主节点上运行的 Jupyter [英] Get VS Code Python extension to connect to Jupyter running on remote AWS EMR master node

查看:47
本文介绍了获取 VS Code Python 扩展以连接到在远程 AWS EMR 主节点上运行的 Jupyter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行在 EMR 主节点上的 Jupyter 服务器,我可以在其中运行 python 和 pyspark 代码,没有任何问题.当尝试让 VS Code Python 扩展连接到同一个 Jupyter 服务器时,我收到以下错误:

I have a working Jupyter server running on an EMR master node where I can run python and pyspark code with no issue. When trying to get the VS Code Python extension to connect to the very same Jupyter server, I get the following error:

Failed to connect to remote Jupyter notebook. 
Check that the Jupyter Server URI setting has a valid running server specified. 
http://***.***.***.***:8888/lab 
Error: Invalid response: 405 Method Not Allowed

我按照 IBM 提供的这些说明.然后按照这些堆栈溢出说明将证书添加到 Chrome 另一个用户链接到 GitHub.

I created my own self-signed certificate on the EMR cluster by following these instructions from IBM. Then added the certificate to Chrome following these stack overflow instructions another user linked to on GitHub.

从 EMR 主节点的 bash 终端:

From the bash terminal of the EMR master node:

# create key and cert
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
# combine key and cert
openssl pkcs12 -inkey key.pem -in certificate.pem -export -out certificate.p12

certificate.p12 下载到我的本地计算机,然后添加到 Chrome:chrome://settings/privacy > 管理证书 > 导入 > 选择并导入 certificate.p12 > 重新启动 VS Code.

Downloaded certificate.p12 to my local computer, and then adding to Chrome: chrome://settings/privacy > Manage certificates > Import > Select and import certificate.p12 > Restarting VS Code.

我仍然遇到同样的错误.

I still get the same error.

  • 我是否应该在本地创建 key.pemcertificate.pem 然后组合成一个证书?
  • 是否需要使用创建 EMR 集群时发布的原始 .pem 密钥?
  • Should I create either the key.pem and certificate.pem on my local then combine into a certificate?
  • Do I need to use the original .pem key issued when creating the EMR cluster?

推荐答案

Jupyter 的较新版本启动了看起来类似于基于终端的 lynx 浏览器.

The newer versions of Jupyter start what appears to be something like the Terminal based lynx browser.

无论我选择哪个终端 shell,启动 Jupyter 后的输出都非常混乱,因为终端浏览器"正在查看的文档"与 Jupyter 服务器的输出混合在一起.

No matter which Terminal shell I choose, the output is extremely chaotic after I launch Jupyter, in that the 'document' that the terminal "browser" is viewing is intermixed with the output of the Jupyter server.

通过所有这些噪音,我可以使用箭头键和 enter 的某种组合以某种方式导航"到以下显示在终端中某处与 Jupyter 输出混合的点(通常突出显示,但取决于哪个终端程序):

Through all of that noise, I can use some combination of the arrow keys and enter to somehow 'navigate' to a point where the following is displayed somewhere in the terminal intermixed with the Jupyter output (usually highlighted, but depends on which Terminal program):

cookie: username-***-***-***-***-****=2|1:0|10:***********|27:username-***-***-***-***-****|44:***********************************k1ZmE=|****************************1bef31e Allow? (Y/N/Always/neVer)

我输入 A 并按 enter.

有时,有时不会,我会在终端中看到以下一小段时间:

Sometimes, and sometimes not, I will see the following in the Terminal for a short time:

Data transfer complete  

然后我可以按 q 并退出 Jupyter 启动的任何终端浏览器,只看到正常的 Jupyter 服务器输出.将完整的 url 复制到 Jupyter 服务器,将其粘贴到 VS Code Python 扩展 python.dataScience.jupyterServerURI 中.

Then I can press q and get out of whatever terminal browser thing Jupyter launched and just see the normal Jupyter server output. Copy the full url to the Jupyter server, paste it into VS Code Python extension python.dataScience.jupyterServerURI.

之后一切都按预期进行.
无需证书或密钥.

Everything works as expected after that.
No certificates or keys needed.

这篇关于获取 VS Code Python 扩展以连接到在远程 AWS EMR 主节点上运行的 Jupyter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆