我正在尝试以root用户身份在Jupyter笔记本中运行pyspark。我通过编辑/root/.jupyter/jupyter_notebook_config.py为笔记本启用了root访问权限。我还编辑了https://blog.sicara.com/get-started-pyspark-jupyter-guide-tutorial-ae2fe84f594f下方法1-配置PySpark驱动程序一节中提到的bashrc文件。但是在尝试以root身份运行pyspark时我得到
xdg-open:没有方法可用于打开“ file:///root/.local/share/jupyter/runtime/nbserver-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'
答案 0 :(得分:0)
升级系统后,我遇到了类似的问题。
该错误表明不应以root模式打开Firefox,但是如果不使用sudo
,则jupyter notebook
会引发权限被拒绝错误。我通过递归更改以下内容的权限来解决了这个问题-尽管我自己对该解决方案并不满意-
~/.local/share/jupyter/runtime/*
基本上,我更改了.local
的权限,然后更改了./local/share
,依此类推,一直到运行时的内容。然后,当我在终端中运行jupyter notebook
(注意,这里没有sudo
)时,它就起作用了。
不过,还有另一种解决方案。如终端窗口所示,您可以手动将指定的URL复制并粘贴到首选浏览器中。但这每次都必须手动完成。
P.S。我的系统是运行Ubuntu 18.04的个人笔记本电脑。