刚刚更新Ubuntu到22.04,现在我打不开Jupyter笔记本

vsaztqbk  于 2022-11-02  发布在  其他
关注(0)|答案(6)|浏览(508)

当我尝试启动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: 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.

这可能是也可能不是问题的一部分。
横贴在这里: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/

t3psigkw

t3psigkw1#

更新:我现在可以使用打印到控制台的URL访问笔记本了。(只需复制并粘贴到Firefox浏览器中即可)
我仍然想弄清楚如何让它只用“Jupyter Notebook”命令打开,就像它在更新前的工作方式一样,但现在这是一个有用的变通办法。

pxq42qpu

pxq42qpu2#

您是否尝试设置

c.NotebookApp.use_redirect_file = False

在jupyter_notebook_configuration.py文件中?
如果您尝试过,是否删除了行首的“#”?
我在Ubuntu 22.04也遇到过同样的问题,这个解决了这个问题。

kknvjkwl

kknvjkwl3#

我首先使用以下命令创建了该文件:jupyter notebook --generate-config,然后我取消注解并更改了c.NotebookApp.use_redirect_file这一行,正如您所说的那样
现在它起作用了!

ycl3bljg

ycl3bljg4#

我在Ubuntu 22.04上使用Firefox时遇到了同样的问题。我注意到在生成的jupyter_notebook_config.py中设置c.NotebookApp.use_redirect_file = False在启动jupyter notebook时有效,但在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上的火狐上。否则,你可以检查jupyter notebook --debug和/或重新安装JupyterLab。

llmtgqce

llmtgqce5#

我使用Epiphany Web浏览器而不是Firefox作为默认Web浏览器,一切都工作正常

djp7away

djp7away6#

我发现的问题是启动器没有使用到Jupyter Notebook的路径。从终端我得到-
这里是jupyter笔记本jupyter笔记本:/home/brombo/miniconda 3/bin/jupyter笔记本电脑/home/brombo/.local/bin/jupyter笔记本电脑
命令“/home/brombo/miniconda 3/bin/jupyter-notebook”将启动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;

相关问题