简体   繁体   English

Jupyter 笔记本错误 Windows 10

[英]Jupyter notebook error Windows 10

Problem:问题:

Jupyter is not able to save, create (I imagene delete) any file type. Jupyter 无法保存、创建(我删除)任何文件类型。 But I can load them fine但我可以很好地加载它们

An example of creating file创建文件的例子

Creating File Failed An error occurred while creating anew file.创建文件失败 创建新文件时出错。

''' Unexpected error while saving file: untitled.txt [Errno 2] No such file or directory: 'C:\\Users\\me\\Documents\\jupyter_notebooks\\untitled.txt' ''' ''' 保存文件时出现意外错误:untitled.txt [Errno 2] 没有这样的文件或目录:'C:\\Users\\me\\Documents\\jupyter_notebooks\\untitled.txt''''

An example of saving file保存文件的例子

C:\WINDOWS\system32>jupyter notebook
[I 17:15:51.888 NotebookApp] JupyterLab beta preview extension loaded from c:\users\me\appdata\local\programs\python\python35\lib\site-packages\jupyterlab
[I 17:15:51.888 NotebookApp] JupyterLab application directory is c:\users\me\appdata\local\programs\python\python35\share\jupyter\lab
[I 17:15:52.091 NotebookApp] Serving notebooks from local directory: C:\Users\me\Documents\jupyter_notebooks
[I 17:15:52.091 NotebookApp] 0 active kernels
[I 17:15:52.091 NotebookApp] The Jupyter Notebook is running at:
[I 17:15:52.091 NotebookApp] http://localhost:8888/?token=*******************************01d1a67a61
[I 17:15:52.091 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:15:52.127 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=*******************************01d1a67a61
[I 17:15:52.472 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 17:16:01.628 NotebookApp] Kernel started: 77255bad-ad7a-4714-8221-1dd90a3a34b5
[W 17:16:11.656 NotebookApp] Timeout waiting for kernel_info reply from 77255bad-ad7a-4714-8221-1dd90a3a34b5
[I 17:16:25.646 NotebookApp] Adapting to protocol v5.0 for kernel 77255bad-ad7a-4714-8221-1dd90a3a34b5
[I 17:16:26.160 NotebookApp] Saving file at /jupyter_jupyter_lab.ipynb
[E 17:16:26.543 NotebookApp] Error while saving file: jupyter_jupyter_lab.ipynb [Errno 2] No such file or directory: 'C:\\Users\\me\\Documents\\jupyter_notebooks\\.~jupyter_jupyter_lab.ipynb'

Tried: Still the same problem试过:还是同样的问题

I double checked the folder location and it matches我仔细检查了文件夹位置,它匹配

C:\\Users\\me\\Documents\\jupyter_notebooks C:\\Users\\me\\Documents\\jupyter_notebooks

I also tried: It install and runs, able to open and read but no changes allowed我也尝试过:它安装并运行,能够打开和读取但不允许更改

pip3 install --upgrade --force-reinstall --no-cache-dir jupyter
~ https://stackoverflow.com/a/42667069/6202092

System:系统:

  • Windows 10视窗 10
  • Python environment: 2.7 & 3.5 Python 环境:2.7 & 3.5
  • package manager: pip / pip3包管理器:pip / pip3

Possible contributing factors: Made some system changes two days ago, and since the problem started.可能的影响因素:两天前进行了一些系统更改,并且自问题开始以来。 I believe is a permission issue.我相信是一个许可问题。 I recall deselecting a "permissions check box" for executing scripts.我记得取消选中用于执行脚本的“权限复选框”。 but it only seemed to affect Jupyter但它似乎只影响 Jupyter

Not acceptable solutions:不可接受的解决方案:

"Try Anaconda", "Reinstall windows" - the system was working fine and continues to work, with the exception of Jupyter enability to make changes “尝试 Anaconda”、“重新安装 Windows” - 系统工作正常并继续工作,除了 Jupyter 能够进行更改

Thank you in advance提前谢谢你

~eb ~eb

I am the author of the question...我是问题的作者...

The problem was a permissions issue , as I mentioned earlier, I did modify the system and could not remember what I had done to prevent Jupyter Notebook from working as before.问题是权限问题,正如我之前提到的,我确实修改了系统,但不记得我做了什么来阻止 Jupyter Notebook 像以前一样工作。 I spent the better part of three days researching the problem and could not find an answer, in frustration, today I posted the problem.我花了三天的大部分时间研究这个问题,但找不到答案,很沮丧,今天我发布了这个问题。 And with the comments and suggestion from a couple of the users I was able to take a better look at the problem and try a few different approaches.根据几个用户的意见和建议,我能够更好地查看问题并尝试几种不同的方法。

I had enabled a feature in "Windows Defender Security Center" that prevented Jupyter from working as before, preventing me from running Notebooks in different locations, more specifically the "Documents" folder.我在“Windows Defender 安全中心”中启用了一项功能,该功能阻止 Jupyter 像以前一样工作,阻止我在不同位置运行Notebooks ,更具体地说是“文档”文件夹。

Should this happen to you:如果您遇到这种情况:

  1. Go to " Windows Defender Security Center "转到Windows Defender 安全中心
  2. Scroll & Click on " Virus & threat protection settings "滚动并点击病毒和威胁防护设置
  3. Scroll down to " Controlled folder access "向下滚动到“受控文件夹访问
  4. Make sure is Disabled确保已禁用

This was the " global " solution I was looking for这是我正在寻找的“全局”解决方案

That should fix a similar problem那应该解决类似的问题

~ eb ~ eb

if your OS is Windows10, may you have to flow this如果你的操作系统是 Windows10,你可能需要流这个

  1. mouse right click the "Anaconda Navigator" icon鼠标右键单击“Anaconda Navigator”图标
  2. and pop-up "Anaconda Navigator" icons properties并弹出“Anaconda Navigator”图标属性
  3. click the "detail properties"单击“详细属性”
  4. Check the checkbox labeled "Run as administrator" as shown below in the text "Select advanced properties for this shortcut" and save it.选中标记为“以管理员身份运行”的复选框,如下所示在文本“为此快捷方式选择高级属性”中并保存。

As Enrique Bruzual mentioned above, this behavior can be caused by having " Controlled folder access " enabled in the Windows Defender Security Center .正如上面提到的 Enrique Bruzual,这种行为可能是由于在Windows Defender 安全中心启用了“受控文件夹访问”。 Disabling it fixes the issue.禁用它可以解决问题。

If you'd like to leave "Controlled folder access" enabled, follow Enrique's steps 1-3, which I have quoted here.如果您想启用“受控文件夹访问”,请按照我在此处引用的 Enrique 的步骤 1-3 进行操作。

  1. Go to " Windows Defender Security Center "转到“ Windows Defender 安全中心
  2. Scroll & Click on " Virus & threat protection settings "滚动并单击“病毒和威胁防护设置
  3. Scroll down to " Controlled folder access "向下滚动到“受控文件夹访问

Then:然后:

  1. Click " Allow an app through Controlled folder access ".单击“允许应用程序通过受控文件夹访问”。
  2. Click on " Add an allowed app " and select your python.exe , jupyter.exe , and jupyter-notebook.exe files.单击“添加允许的应用程序”并选择您的python.exejupyter.exejupyter-notebook.exe文件。 You can find python.exe in your main Python installation directory and the other two in the " Scripts " subdirectory of your main Python installation directory.您可以在 Python 主安装目录中找到python.exe,而在 Python 主安装目录的“ Scripts ”子目录中可以找到另外两个。
  3. Restart jupyter if it was running when you made these changes.如果进行这些更改时jupyter正在运行,请重新启动它。

You have to add the files one at a time, so it will take a bunch of clicking.您必须一次添加一个文件,因此需要多次点击。 I was able to save my jupyter notebooks without issue after doing this.执行此操作后,我能够毫无问题地保存我的 jupyter 笔记本。

NOTE: If you have both Python 2 and 3 installed, you must do this for each Python installation.注意:如果您同时安装了 Python 2 和 3,则必须为每个 Python 安装执行此操作。

I had a similar issue on Windows 10. The resolution was as follows:我在 Windows 10 上遇到了类似的问题。解决方案如下:

  1. open a cmd window as administrator以管理员身份打开一个cmd窗口
  2. takeown /R /F path_to_folder takeown /R /F path_to_folder
  3. icacls path_to_folder /T /C /RESET icacls path_to_folder /T /C /RESET

Further details in https://www.deskmodder.de/wiki/index.php?title=NTFS_Berechtigungen_f%C3%BCr_Dateien_und_Ordner_zur%C3%BCcksetzen_Windows_10 https://www.deskmodder.de/wiki/index.php?title=NTFS_Berechtigungen_f%C3%BCr_Dateien_und_Ordner_zur%C3%BCcksetzen_Windows_10中的更多详细信息

Are you using the windows command prompt or the anaconda bash prompt?您使用的是 windows 命令提示符还是 anaconda bash 提示符? You can enter into a conda env with a windows command prompt but it will not let you create a new notebook.您可以使用 Windows 命令提示符进入 conda env,但它不会让您创建新笔记本。 If you go to "anaconda prompt" from the programs menu and go into "bash" you get permissions如果您从程序菜单转到“anaconda prompt”并进入“bash”,您将获得权限

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

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