简体   繁体   English

在 Ubuntu 系统中无法打开 Jupyter Notebook

[英]Cannot open Jupyter Notebook in Ubuntu system

I am trying to open Jupyter Notebook from Ubuntu terminal, but it fails to start because of permission issues.我正在尝试从 Ubuntu 终端打开 Jupyter Notebook,但由于权限问题而无法启动。 Specifically, a webpage would open up in the Firefox browser, which displays the error message具体来说,会在 Firefox 浏览器中打开一个网页,显示错误消息

The file at /home/<user>/.local/share/jupyter/runtime/nbserver-61219-open.html is not readable.

I have found an similar issue at Cannot open new Jupyter Notebook [Permission Denied] , which suggests that I should change the ownership of the folder by typing the command我在Cannot open new Jupyter Notebook [Permission Denied]发现了一个类似的问题,这表明我应该通过键入命令来更改文件夹的所有权

sudo chown -R <user>:<user> ~/.local/share/jupyter 

However, this did not work for me.但是,这对我不起作用。 I have also tried other suggestions from https://github.com/microsoft/WSL/issues/3608 .我还尝试了来自https://github.com/microsoft/WSL/issues/3608的其他建议。 The commands sudo jupyter-notebook --allow-root or sudo jupyter notebook --allow-root result in errors saying that the commands are not found.命令sudo jupyter-notebook --allow-rootsudo jupyter notebook --allow-root导致错误提示找不到命令。 I have also tried chmod -R 777 <my directory> , and the same error still occur.我也试过chmod -R 777 <my directory> ,同样的错误仍然发生。

I realize that at runtime, Jupyter Notebook produces a .html file and a .json file in /home/<user>/.local/share/jupyter/runtime/ , the directory where the permission error is reported.我意识到在运行时,Jupyter Notebook 会在/home/<user>/.local/share/jupyter/runtime/报告权限错误的目录中生成一个 .html 文件和一个 .json 文件。 By running ls -l on this directory during runtime, it seems like I (both the user and the group) do not have execute permission on these two files, but have read and write permissions.通过在运行时在此目录上运行ls -l ,似乎我(用户和组)对这两个文件没有执行权限,但具有读写权限。 Is this the cause to my problem?这是我的问题的原因吗? How can I fix this?我怎样才能解决这个问题?

(Additionally, I installed Jupyter Notebook using pip inside the conda base environment, and all the above commands are executed in the same environment) (另外我在conda基础环境中使用pip安装了Jupyter Notebook,以上所有命令都是在同一个环境下执行的)

Specs:眼镜:

  • Ubuntu version: 21.10 Ubuntu版本:21.10

  • Jupyter Notebook version: 6.4.5 Jupyter 笔记本版本:6.4.5

  • Miniconda version: 4.10.3 Miniconda 版本:4.10.3

  • Python version: 3.9.5 Python版本:3.9.5

  • Web browser: Firefox网络浏览器:火狐

Try changing the version of the Jupyter Notebook installed.尝试更改已安装的 Jupyter Notebook 的版本。 It worked for me (I am using Ubuntu 22.04 pre release).它对我有用(我使用的是 Ubuntu 22.04 预发行版)。

Type the following in terminal: pip install notebook==5.6.0在终端中输入以下内容: pip install notebook==5.6.0

Ubuntu switched Firefox to a snap in 21.10. Ubuntu 在 21.10 中将 Firefox 切换为 snap。 Snaps can't open files under directories that are hidden in your home directory, like ~/.local. Snaps 无法打开隐藏在主目录中的目录下的文件,例如 ~/.local。

I have the same issue and am hoping for a solution less drastic than removing the snap and reinstalling Firefox using apt.我有同样的问题,我希望有一个比删除 snap 并使用 apt 重新安装 Firefox 更温和的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM