【问题标题】:How to set the Jupyter default user for Pyspark in GCP Dataproc如何在 GCP Dataproc 中为 Pyspark 设置 Jupyter 默认用户
【发布时间】:2022-01-03 23:13:21
【问题描述】:

在连接到 GCP Spark 集群的 Jupyter 笔记本中,单元格 !pip3 install pyLDAvis==3.2.1 可以工作,但会发出警告:

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. 
It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

警告不是 pyLDAvis 独有的,其他软件包——甚至是 numpy——也会给出相同的警告。

root 运行笔记本不应该是默认设置。如何将笔记本中的默认用户设置为singhj 而不是root?我已经通过IPython Configuration and customization 搜索任何提示。

配置:GCP Dataproc 中的新集群,默认 Jupyter 笔记本,没有任何自定义。

【问题讨论】:

    标签: pyspark jupyter-notebook google-cloud-dataproc


    【解决方案1】:

    Dataproc 集群中的 Jupyter 服务器由文件 /usr/lib/systemd/system/jupyter.service 中定义的 systemd 服务运行。

    如果您想更改它运行的用户,那么您可以修改该文件并将User=root 行替换为您想要的用户名(例如您的示例中的User=singhj)。

    然后,一旦文件被更新,通过以 root 身份运行以下命令来重新启动 systemd 服务:

    systemctl daemon-reload 
    systemctl restart jupyter
    

    如果您想自动执行此操作,您可以编写 initialization action 以在集群创建时进行更改。

    【讨论】:

      猜你喜欢
      • 2016-12-23
      • 2016-08-30
      • 1970-01-01
      • 1970-01-01
      • 2015-08-25
      • 2017-08-16
      • 2018-09-05
      • 2018-07-10
      • 2020-05-31
      相关资源
      最近更新 更多