Jupyter notebook error Windows 10
Asked Answered
C

5

5

Problem:

Jupyter is not able to save, create (I imagene delete) any file type. 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' '''

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

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://mcmap.net/q/166416/-error-when-executing-jupyter-notebook-no-such-file-or-directory

System:

  • Windows 10
  • Python environment: 2.7 & 3.5
  • package manager: 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

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

Thank you in advance

~eb

Cassidy answered 22/3, 2018 at 18:39 Comment(8)
This isn't really a solution, but if you start Jupyter with admin privileges and it starts working fine, then it's definitely a permissions issue.Adria
I tried it, as you suggested, (https://mcmap.net/q/1676811/-how-can-i-run-jupyter-notebook-in-admin-privilege) and still get similar problem. Thank you!Cassidy
Other people who have had similar issues (here and here) on Linux have found that it is a permissions issue, but because Windows is weird: what do you see when you look at the Properties of your C:\Users\me\Documents\jupyter_notebooks folder under Security? Your user should have Full control checked.Adria
>> Under security in the "jupyter_notebooks" under folder security settings, the permissions are the same as in my user "me" settings. But I did a test, where I generated a new config file, saving the old one. with the new one, defaulting to "C:\Users\me\AppData\Local\Programs\Python\Python35\Scripts" folder, there I can create, save and delete files. It could be permission as you say or able to resolve custom directory paths.Cassidy
Very very strange! It seems that Jupyter doesn't like handling files outside its own directory, which definitely isn't the usual behaviour. I'm thinking that maybe it's a problem of JupyterLab, but either way, it's probably best for now if you create a folder for your notebooks in the Scripts folder and place a shortcut to it somewhere else for convenience.Adria
@NiayeshIsky Not really, as I mentioned in my original post, everything was working before, just fine fine (including JupyterLab) a couple of days ago. I am looking for a global solution. I am more inclined to think is a global variable or permission issue as you commented and mentioned in other posts, most of those are Linux problems. I will try modifying the new config file, to my notebook directory [not hopeful] but the logical thing to doCassidy
This error did not go, despite changing the permissions (from properties) or Bit defender settings. However, when I created a new folder as a regular user (not admin) then it started working from that folder. I guess, the folder where you get "permission denied" error must have been created as Admin.Swill
A one-time workaround is to download the notebook: File -> Download as -> Notebook (.ipnb), and move the file to the desired location.Backhanded
C
15

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. 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.

Should this happen to you:

  1. Go to "Windows Defender Security Center"
  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

Cassidy answered 23/3, 2018 at 3:46 Comment(5)
I'm glad you found it!Adria
You really help me a lot. I have no such issue on win10 Pro. However, such problem occurs when I work on win10 Enterprise distribution.Grimy
I am glad it worked out for you, in my case I made the change by mistake, I had forgotten what I did. but once I found the answer and updated it, I haven’t had to worry about it.Cassidy
Thanks for the suggestion. It is enough if the folders which the Jupyter notebook exists is removed from the list of folders for Controlled Folder access. Alternatively, you could add python, Jupiter and notebook to programs permitted to make changes.Balinese
These settings no longer exist, as of 2021Remittee
W
3

if your OS is Windows10, may you have to flow this

  1. mouse right click the "Anaconda Navigator" icon
  2. and pop-up "Anaconda Navigator" icons properties
  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.
Wildawildcat answered 4/3, 2019 at 9:9 Comment(0)
A
2

As Enrique Bruzual mentioned above, this behavior can be caused by having "Controlled folder access" enabled in the Windows Defender Security Center. 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.

  1. Go to "Windows Defender Security Center"
  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. 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.
  3. Restart jupyter if it was running when you made these changes.

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.

NOTE: If you have both Python 2 and 3 installed, you must do this for each Python installation.

Alanealanine answered 17/1, 2019 at 21:59 Comment(0)
D
0

I had a similar issue on Windows 10. The resolution was as follows:

  1. open a cmd window as administrator
  2. takeown /R /F path_to_folder
  3. 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

Dagny answered 4/4, 2020 at 7:43 Comment(0)
H
-2

Are you using the windows command prompt or the anaconda bash prompt? You can enter into a conda env with a windows command prompt but it will not let you create a new notebook. If you go to "anaconda prompt" from the programs menu and go into "bash" you get permissions

Harwin answered 30/4, 2020 at 0:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.