如何在 Dataproc 上安装 Jupyter/iPython?

How do I install Jupyter/iPython on Dataproc?

我想使用 Jupyter/iPython on Cloud Dataproc。如何在创建新集群时自动安装和配置它?

Cloud Dataproc 团队 GitHub repository of initialization actions containing sample and often-used initialization actions. There is specifically one for iPython in the repository you can use to automatically install and configure iPython. The initialization action page 详细介绍了如何在创建新集群时使用脚本。

tl;dr 过程:

  1. Download iPython
  2. 的初始化动作
  3. 将初始化操作保存到 Google Cloud Storage 存储桶
  4. Create a new cluster with the Google Cloud SDK 使用 --initalization-actions 标志:

    gcloud beta dataproc clusters create <my-dataproc-cluster> --initialization-actions gs://<my-bucket>/ipython.sh

  5. Create an SSL tunnel and SOCKS proxy到集群

  6. 打开 Web 浏览器到主节点 http://<my-dataproc-cluster>-m:8123

在上面的示例中,您需要将 <my-bucket> 替换为您的 Cloud Storage 存储桶名称,将 <my-dataproc-cluster> 替换为您的集群名称。另请注意,对于第 5 步,URL 应将 -m 添加到您的集群名称中,以便您访问您的 主节点 .

除了之前的回答之外,article 中对这个过程进行了非常详细的描述。此外,它涵盖了 Python 3 和将笔记本保存在云存储中。