【问题标题】:Jupyterhub does not run through plistJupyterhub 不通过 plist 运行
【发布时间】:2018-12-31 15:30:57
【问题描述】:

我一直在运行 jupyterhub 0.91。在 MacOS Sierra(版本 10.12.6)中成功,并且可以从连接到此 MacOS 网络的任何客户端访问笔记本。我试图将 jupyterhub 作为一项服务。为此,我在 /Users/xyz/Library/LaunchAgents 中创建了 org.xyz.jupyter.plist 文件(xyz 是我的用户 ID ) 具有以下内容(为简洁起见,省略了标准页眉和页脚信息):

<dict>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>org.xyz.jupyter</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/xyz/Library/LaunchAgents/jupyterhub.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/Users/Shared/jupyterhub.err</string>
    <key>StandardOutPath</key>
    <string>/Users/Shared/jupyterhub.out</string>
    <key>KeepAlive</key>
    <true/>
</dict>

并且,/Users/xyz/Library/LaunchAgents/jupyterhub.sh的内容是:

PID=$(pgrep -f jupyterhub)
if [ "x$PID" = "x" ]; then # Ensure only one jupyterhub instance is running
    sudo /opt/anaconda/anaconda3/bin/jupyterhub -f /Users/Shared/jupyterhub_config.py
fi

我独立运行了上述 shell 脚本,jupyterhub 启动时没有出现任何问题。但是,当我重新启动 Mac 以自动启动集线器时,出现以下错误(摘录):

  File "/opt/anaconda/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'configurable-http-proxy': 'configurable-http-proxy'

我检查了执行 jupyterhub 的位置 /opt/anaconda/anaconda3/bin/ 并找到了文件 configurable-http-proxy。然后,我将它复制到: /opt/anaconda/anaconda3/lib/python3.6 从中执行 subprocess.py 并报告缺少 configurable-http-proxy。尽管如此,错误仍然是一样的。请帮忙?

【问题讨论】:

    标签: macos http-proxy jupyterhub


    【解决方案1】:

    当启动 jupyterhub 的代理运行时,它似乎不知道可执行文件的位置。在这种情况下,它不知道 configurable-http-proxy 驻留在哪里。因此,我添加了一个 EnvironmentVariables 指令,其中包含上述文件的路径 (/opt/anaconda/anaconda3/bin)。修改后的plist文件为:

    <dict>
        <key>EnvironmentVariables</key>
        <dict>
          <key>PATH</key>
          <string>/opt/anaconda/anaconda3/bin:/bin:/usr/bin</string>
        </dict>
        <key>Label</key>
        <string>org.xyz.jupyter</string>
        <key>ProgramArguments</key>
        <array>
            <string>/opt/anaconda/anaconda3/bin/jupyterhub</string>
            <string>-f</string>
            <string>/Users/Shared/jupyterhub_config.py</string>
        </array>
    

    我的问题中显示的其他内容。

    【讨论】:

      猜你喜欢
      • 2021-06-10
      • 2019-06-04
      • 2020-07-04
      • 2016-07-08
      • 1970-01-01
      • 1970-01-01
      • 2011-02-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多