刚刚将 Ubuntu 更新到 22.04,现在我无法打开 Jupyter Notebook



当我尝试启动Jupyter Notebook时,浏览器启动,我得到以下错误:

Access to the file was denied
The file at /home/benjamin/.local/share/jupyter/runtime/nbserver-11758-open.html is not readable.
It may have been removed, moved, or file permissions may be preventing access.

我试着运行

jupyter lab clean --all
pip3 install jupyterlab --force-reinstall

按照这里的建议:Jupyter Notebook:访问文件被拒绝。命令运行了,但我仍然得到访问文件被拒绝的错误。同样,在重新安装命令中,它会输出如下内容:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
spyder 4.2.5 requires pyqt5<5.13, which is not installed.
spyder 4.2.5 requires pyqtwebengine<5.13, which is not installed.
conda-repo-cli 1.0.4 requires pathlib, which is not installed.
anaconda-project 0.9.1 requires ruamel-yaml, which is not installed.
spyder 4.2.5 requires jedi==0.17.2, but you have jedi 0.18.1 which is incompatible.
spyder 4.2.5 requires parso==0.7.0, but you have parso 0.8.3 which is incompatible.
sphinx 4.0.1 requires Jinja2<3.0,>=2.3, but you have jinja2 3.1.1 which is incompatible.
sphinx 4.0.1 requires MarkupSafe<2.0, but you have markupsafe 2.1.1 which is incompatible.
python-language-server 0.36.2 requires jedi<0.18.0,>=0.17.2, but you have jedi 0.18.1 which is incompatible.
fermipy 1.0.1+5.g5a57 requires astropy<4, but you have astropy 4.2.1 which is incompatible.

这可能是问题的一部分,也可能不是。

交叉贴在这里:https://discourse.jupyter.org/t/after-updating-to-ubuntu-22-04-i-am-no-longer-able-to-access-jupyter-notebook/13991

: https://askubuntu.com/questions/1404330/after-updating-to-ubuntu-22-04-i-am-no-longer-able-to-access-jupyter-notebook

和reddit: https://www.reddit.com/r/learnpython/comments/uaipzo/i_just_updated_my_machine_to_ubuntu_2204_now_i/

你试过设置

c.NotebookApp.use_redirect_file = False

在jupyter_notebook_configuration.py文件中?

如果您尝试了,您是否删除了行首的"#"?

我在Ubuntu 22.04中也遇到了同样的问题,这个修复了它。

更新:我现在能够通过使用打印到控制台的URL访问笔记本。(只需复制并粘贴到Firefox浏览器中)

我还是想弄清楚如何只用"jupyter notebook"打开它;命令它在更新之前的工作方式,但现在这是一个有用的解决方案。

我首先用:Jupyter notebook——generate-config然后取消注释并更改c.NotebookApp行。Use_redirect_file

,现在它工作了!

我在Ubuntu 22.04上使用snap的Firefox时遇到了同样的问题。我注意到,在启动jupyter notebook时,在生成的jupyter_notebook_config.py中设置c.NotebookApp.use_redirect_file = False有效,但jupyter-lab失败(您粘贴的错误)。我发现做一些类似的事情来解决jupyter-lab的问题:

jupyter server --generate-config

编辑生成的./jupyter/jupyter_server_config.py,设置c.ServerApp.use_redirect_file = False。现在运行jupter-lab也适用于snap firefox。也许你可以尝试这种方式,只是通过jupyter-lab运行,如果它也适用于你。

顺便说一句。如果你只使用Chrome,这些都不需要,不知何故,这个问题只出现在Ubuntu 22.04上的firefox上。否则,你可以检查jupyter notebook --debug和/或重新安装JupyterLab。

我使用epiphany浏览器而不是Firefox作为默认浏览器,一切都很好

我发现的问题是启动器没有使用通往Jupyter Notebook的有效路径。从终端我得到:

$ whereis jupyter-notebook
jupyter-notebook: /home/brombo/miniconda3/bin/jupyter-notebook /home/brombo/.local/bin/jupyter-notebook

命令/home/brombo/miniconda3/bin/jupyter-notebook将启动笔记本,但/home/brombo/.local/bin/jupyter-notebook不会。如果你在.local/share/applications/jupyter-notebook.desktop的exec行中使用第一个,一切都可以工作-

[Desktop Entry]
Name=Jupyter Notebook
Comment=Run Jupyter Notebook
Exec=/home/brombo/miniconda3/bin/jupyter-notebook %f
Terminal=true
Type=Application
Icon=notebook
StartupNotify=true
MimeType=application/x-ipynb+json;
Categories=Development;Education;
Keywords=python;

相关内容

  • 没有找到相关文章

最新更新