DonJayamanne / vscodeJupyter

Jupyter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter
MIT License
334 stars 34 forks source link

Permission denied error when attempting to start a Jupyter kernel #24

Open DonJayamanne opened 7 years ago

DonJayamanne commented 7 years ago

From @Ramlimab on November 4, 2016 3:26

Dear Don,

Am just starting to use VSCode for my python programming needs. Unfortunately, I encounter this error when I try to run a sample Jupyter code.

Is there some permissions I need to allow to VSCode to utilize Jupyter that I might have missed? Thanks in advance!

Operating System: Windows 7 VS Code: 1.7.1 Python Extension: 0.5.0 Python Distribution: Anaconda 64-bit

image

Copied from original issue: DonJayamanne/pythonVSCode#483

DonJayamanne commented 7 years ago

Please check out the following: http://stackoverflow.com/questions/19231425/ipython-permission-denied

DonJayamanne commented 7 years ago

@Ramlimab , any luck with the above link?

DonJayamanne commented 7 years ago

From @Ramlimab on November 9, 2016 1:28

Hi Don, sorry no I still can't figure out the problem.

The post suggests to check port 5905 and suggests some related issue with PyZMQ but I am not using that and the port doesn't seem to be occupied by any process after checking netstat -ab.

Also, I seem to be able to run IPython consoles fine using Spyder and through running Jupyter notebooks on the browser, the problem seems to only appear when trying it on VSCode. I have also checked Windows Firewall and it currently allows port access (both TCP and UDP) to VSCode.

Not sure what else I can do to fix the problem.

DonJayamanne commented 7 years ago

From @Agnpalm on January 18, 2017 15:15

I have this problem too, and I think the issue is that the kernel*.json files are created in the current working directory.

First, the issue isn't present when I open a folder, only when I open a single Python file. When I open a folder, the kernel.json files are created in the folder root (and cluttering the project workspace), when I open a single file they're created in 'C:\Program Files (x86)\Microsoft VS Code', as per #653. If I open an elevated VS Code I get a bunch of kernel.json files there as expected, and no error message. When running VS Code in normal mode it lacks the permission to create files in 'C:\Program Files (x86)\', and that's why it fails with the error PermissionError: [Errno 13] Permission denied: 'kernel-9ea7f234-3d87-4669-93de-fb8091301cf7.json'

Jupyter's documentation says that the kernel files should be created in the '%PROGRAMDATA%\jupyter\runtime' folder on Windows, but I suspect they actually mean '%APPDATA'\jupyter\runtime', since %PROGRAMDATA% is system wide and %APPDATA% is per user. I also already had an '%APPDATA'\jupyter\runtime' folder with some files in, but no '%PROGRAMDATA%\jupyter\runtime'. Putting the kernel*.json files in %APPDATA% instead of cwd would most likely solve the issue.

For some reason the files aren't getting deleted either, so I keep getting more and more kernel*.json files in my project path. If they're created in the right folder this will be less of an issue, but it's probably best if they're deleted when no longer needed if possible.

DonJayamanne commented 7 years ago

From @gandhis1 on January 18, 2017 15:33

@Agnpalm your post is related to https://github.com/DonJayamanne/pythonVSCode/issues/506

Forces you to put an explicit .gitignore entry for these