更新到 Ubuntu 22.04 后,我无法再访问 Jupyter Notebook

更新到 Ubuntu 22.04 后,我无法再访问 Jupyter Notebook

当我尝试启动 Jupyter Notebook 时,浏览器(firefox)启动并出现以下错误:

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

按照这里的建议:https://stackoverflow.com/questions/70753768/jupyter-notebook-access-to-the-file-was-denied。命令运行了,但我仍然收到“文件访问被拒绝”错误。此外,在重新安装命令中,它输出以下内容:

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.

然后,我尝试强制更新/重新安装消息中提到的软件包(spyder 和 sphinx),然后再次重新安装 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.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 5.3.0 requires ipython<8.0.0,>=7.31.1, but you have ipython 8.2.0 which is incompatible.spyder-kernels 2.3.0 requires ipython<8,>=7.31.1; python_version >= "3", but you have ipython 8.2.0 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.pytest 6.2.3 requires pluggy<1.0.0a1,>=0.12, but you have pluggy 1.0.0 which is incompatible.fermipy 1.0.1+5.g5a57 requires astropy<4, but you have astropy 4.2.1 which is incompatible.

我最后尝试的是设置

c.NotebookApp.use_redirect_file = False

并在文件 jupyter_notebook_configuration.py 中取消注释该行,但问题仍然存在,我收到错误“访问文件被拒绝”

我正在使用 Ubuntu 22.04。有人知道如何解决这个问题吗?

编辑:交叉发布于此处:https://discourse.jupyter.org/t/after-updating-to-ubuntu-22-04-i-am-no-longer-able-to-access-jupyter-notebook/13991

这里:https://stackoverflow.com/questions/71983770/just-updated-ubuntu-to-22-04-now-i-cant-open-jupyter-notebook

Reddit 上也有报道:https://www.reddit.com/r/learnpython/comments/uaipzo/i_just_updated_my_machine_to_ubuntu_2204_now_i/

答案1

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

我仍然想弄清楚如何仅使用“jupyter notebook”命令打开它,就像更新之前一样,但目前这是一个有用的解决方法。

答案2

我也遇到过同样的问题。真的很痛苦。至少临时解决方案使用 Chrome 作为默认浏览器。但我真的不明白为什么 Firefox 位于 snap 商店中却无法与 Jupyter 兼容。

相关内容