我试图以root用户的身份在Jupyter笔记本上运行pyspark。我通过编辑 root.jupyterjupyter_notebook_config.py 启用了笔记本的 root 访问。我还编辑了在 https:/blog.sicara.comget-started-pyspark-jupyter-guid-tutorial-ae2fe84f594f。 方法1 - 配置PySpark驱动。然而,当我试图以root身份运行pyspark时,我得到的结果是
xdg-open: 没有打开'file:/root.localsharejupyterruntimenbserver-20051-open.html'的方法。
# pyspark
[I 17:12:15.544 NotebookApp] Serving notebooks from local directory: /home/applied
[I 17:12:15.544 NotebookApp] The Jupyter Notebook is running at:
[I 17:12:15.544 NotebookApp] http://localhost:8888/?token=c5408eb73daf9b0c7c3a92418b69e128d01b1c11a8ed8d75
[I 17:12:15.544 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:12:15.553 NotebookApp]
To access the notebook, open this file in a browser:
file:///root/.local/share/jupyter/runtime/nbserver-20384-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=c5408eb73daf9b0c7c3a92418b69e128d01b1c11a8ed8d75
Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /home/applied/.Xauthority which is owned by applied.)
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/run-mailcap line 528.
[20515:20515:0612/171215.882932:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Warning: program returned non-zero exit code #1
Opening "/root/.local/share/jupyter/runtime/nbserver-20384-open.html" with Firefox Web Browser (text/html)
Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /home/applied/.Xauthority which is owned by applied.)
[20586:20586:0612/171216.094968:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /home/applied/.Xauthority which is owned by applied.)
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: iceweasel: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: seamonkey: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: mozilla: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: epiphany: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: konqueror: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: chromium-browser: not found
[20614:20614:0612/171216.184980:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening 'file:///root/.local/share/jupyter/runtime/nbserver-20384-open.html'
在我升级系统后,我也遇到了类似的问题。sudo
不使用,那么 jupyter notebook
抛出 不准 错误。我解决了这个问题--虽然我自己对这个解决方案不是很满意--通过递归地改变下面的权限。
~/.local/share/jupyter/runtime/*
所以基本上,我改变了以下文件的权限 .local
那么 ./local/share
等,一直到运行时的内容。然后,当我运行 jupyter notebook
(注,不 sudo
这里)在终端,它的工作。
不过,还有一种解决办法。正如终端窗口所说,你可以手动复制并粘贴指定的URL到你喜欢的浏览器中。但每次都要手动完成。
P.S.我的系统是一台运行Ubuntu 18.04的个人笔记本。