Closed bigrat911 closed 2 years ago
Thanks for the bug. Are you running VS code as the same user as yourself? Seems odd that we wouldn't be able to write to your users folder.
Thanks for the bug. Are you running VS code as the same user as yourself? Seems odd that we wouldn't be able to write to your users folder.
Yes, looks strange. I am running it as the same user as myself, and I don't know how to use another user. I wonder is "Jupyter Server: No Kernel Python: Not Started" normal??
It should have that status before you run any cells, but then it should register the kernel. It looks like it's not able to write to the user location on disk.
Does that place actually exist? Is this location writable by you?
/Users/XXXX/Library/Jupyter/Kernels
https://www.reddit.com/r/vscode/comments/eq2bfv/vs_code_jupyter_server_no_kernel_python_not/
For some reason this fixed the issue for me - hopefully it's helpful.
It's supposed to say no server/no kernel until you run. That's by design. That's not the issue @bigrat911 is seeing though. When @bigrat911 runs a cell, it still doesn't work because we can't write the kernel.json file to their user directory.
@rchiodo thanks for the help so far. I read through the whole issue but I am confused/unsure what "fix" you are referring to. Do you mind telling me what the instructions are or what you are referring to?
I also encountered the same problem, the webpage could not be opened, how to solve this problem, thanks.
This issue is a problem with VS code writing to the /users/<user name>/library/jupyter/kernels
folder. If you're having this issue it would show this problem in the console output (Help | Toggle Developer Tools, click on the console page).
There is another problem where if conda doesn't get activated, you can't run any jupyter code. There's multiple issues related to that: https://github.com/microsoft/vscode-python/issues/9566 (which the fix is already in our insider's build) https://github.com/microsoft/vscode-python/issues/8928 (which is currently being worked on).
@brando90 I believe your problem was entirely to do with conda not being setup right. I believe? @DonJayamanne helped you out in the comments for microsoft/vscode-python#9105
@weijew I'm not sure what your problem is. What webpage could not be opened?
@brando90 I believe your problem was entirely to do with conda not being setup right. I believe?
sort of. I used the same .bashrc
and .zshrc
files in pycharm and their jupyter feature worked fine. I shouldn't need to change my files for vs code to work...specially if my terminal works normal regardless of those files etc...that's my 2 cents.
But yes, for now we found a solution to it.
Thanks for your answer, I solved the problem. Something went wrong with my conda activation
@rchiodo Even with the hints in this thread so far, I'm unable to resolve the issue. Still getting Jupyter Server: No Kernel, Python: Not Started
. My console shows the following errors
Error Python Extension: 2020-01-27 13:24:05: Failed to serialize gatherRules for DATASCIENCE.SETTINGS [TypeError: Cannot convert object to primitive value at Array.join (
) at Array.toString ( ) at /Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:1:12243 at Array.forEach ( ) at Object.l [as sendTelemetryEvent] (/Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:1:12160) at y.sendSettingsTelemetry (/Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:75:708637) at y.r.value (/Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:1:92097) at Timeout._onTimeout (/Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:1:90616) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7)] t.log @ console.ts:137 console.ts:137 [Extension Host] Error Python Extension: 2020-01-27 13:24:11: Failed to create File hash for interpreter /usr/local/Caskroom/miniconda/base/envs/old-env/bin/python [Error: ENOENT: no such file or directory, lstat '/usr/local/Caskroom/miniconda/base/envs/old-env/bin/python'] { errno: -2, code: 'ENOENT', syscall: 'lstat', path: '/usr/local/Caskroom/miniconda/base/envs/old-env/bin/python'}
The first is probably unrelated but the second seems to suggest that it's looking for a kernel in an old deleted conda environment. I looked in
/Users/janosh/Library/Jupyter/kernels/python361064bitoldenvconda79da1f2e6bbd4084ac835e29ddf1536d
and replaced all mentions of oldenv
with newenv
. Made no difference, the error remains. I checked the permissions: drwxr-xr-x
. Nothing unusual AFAICT. At this point I wonder where the reference to the old env is even coming from.
@janosh what does jupyter kernelspec list
show?
@rchiodo This is what I get
Available kernels: python361064bitoldenvconda79da1f2e6bbd4084ac835e29ddf1536d /Users/janosh/Library/Jupyter/kernels/python361064bitoldenvconda79da1f2e6bbd4084ac835e29ddf1536d python3 /usr/local/Caskroom/miniconda/base/envs/newenv/share/jupyter/kernels/python3
@janosh can you attach your console log? That should list out where we're finding the oldenv from.
@rchiodo Sure thing:
@janosh that doesn't look like the entire log. Did you apply a filter? That looks like only the errors.
@rchiodo Ah sorry, I thought we only cared about the errors. Here's the full log.
What does conda info --envs
report? Looks like we're finding the oldenv during our lookup. Do you have this environment set as the current python?
@rchiodo conda info --envs
returns
# conda environments:
#
base * /usr/local/Caskroom/miniconda/base
newenv /usr/local/Caskroom/miniconda/base/envs/newenv
The env shown in the status bar is newenv
.
Hmm. @DonJayamanne do we cache the environments somewhere? This is on a linux machine so it's not in the registry. Where would the 'oldenv' environment come from if not from conda info --envs?
In case it helps to pinpoint the issue, if I try to execute a cell in a blank Jupyter notebook (rather than in the interactive window), I get the error:
Error: Jupyter cannot be started. Error attempting to locate jupyter: at A.startServerImpl (/Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:1:770704) at async A.ensureServerActive (/Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:1:770251) at async A.clearResult (/Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:1:766749) at async A.reexecuteCell (/Users/janosh/.vscode/extensions/ms-python.python-2020.2.59126-dev/out/client/extension.js:75:889464)
we cache the environments
Yes it's cached in the memento. @janosh
Jupyter
output panel and let us know what's in there?Select Jupyter Interpreter..
and let us know what currently selected, should be displayed in the picker input as a placeholder. Please select an interpreter that you'd like to use for Jupyter from this list.Open the command Select Jupyter Interpreter.. and let us know what currently selected, should be displayed in the picker input as a placeholder. Please select an interpreter that you'd like to use for Jupyter from this list.
@DonJayamanne Cool! I didn't know about this command. I just selected newenv
in the resulting dropdown and all is back to working! Thanks a lot! 👍
Are you still interested in the Jupyter output? I'm afraid I can't reproduce the issue now since I can't reselect the old deleted env that was apparently cached somewhere.
I suspect there are some more errors logged in the console window, possibly with more details, please could you paste your entire log.
I did upload the full logs above.
@DonJayamanne maybe we have a bug in our 'working jupyter' cache? That if it doesn't work, we don't search elsewhere?
Oh and thanks @janosh
@rchiodo No problem and thanks for your help!
Hi @bigrat911 in my case I had similar issue with Jupyter server and it worked well by doing: 1º Start new .ipynd notebook in Vs 2º Ctrl+shift + P >> Python: Specify local or remote server for connections 3º Default 4º Run some code.
Basically I changed the server and worked well.
Hope this will be helpfull.
For me the issue was fixed by installing the ipykernel
. Try to install it either with pip
or conda
in your environment and restart VSCode.
Error: Activating Python 3.7.4 64-bit ('base': conda) to run Jupyter failed with Error: spawn cmd ENOENT. the vscode writes
Alright. I solved the problem, It is related to the Environment Variables Path. %SystemRoot%\system32 was missing into the PATH variables for the user. I added %SystemRoot%\system32 to the PATH variable and moved it to the top of the list. No errors, correct output.
thanks for this guy !
Hi there,
I'm newbie. This is my first day using VS code and I'm having the same issue with the jupyter notebook. I'm running on Windows.
Here is the console log that I get
Error Python Extension: 2020-02-11 23:04:29: Error starting server in serverPreload: [Error: Jupyter notebook failed to launch. Error: The Jupyter notebook server failed to launch in time at E.start (c:\Users\me\.vscode\extensions\ms-python.python-2020.2.62710\out\client\extension.js:1:820363)] Jupyter notebook failed to launch. Error: The Jupyter notebook server failed to launch in time Error Python Extension: 2020-02-11 23:04:29: DataScience Error [Error: Jupyter notebook failed to launch. Error: The Jupyter notebook server failed to launch in time at E.start (c:\Users\me\.vscode\extensions\ms-python.python-2020.2.62710\out\client\extension.js:1:820363)] rejected promise not handled within 1 second: Error: Jupyter notebook failed to launch. Error: The Jupyter notebook server failed to launch in time stack trace: Error: Jupyter notebook failed to launch. Error: The Jupyter notebook server failed to launch in time at E.start (c:\Users\me\.vscode\extensions\ms-python.python-2020.2.62710\out\client\extension.js:1:820363)
Thanks a lot for your help.
@ditordccaa Thanks for providing feedback, however please could you create a new issue with the details.
Please try enabling the setting for Disable Jupyter Auto Start
and providing the logs for both options (with the setting on and without) - Please ensure you re-load VS Code when making this change.
Getting the same issue as original post. For me it starts when using Shift + Enter to run selected code in the Interactive Python interpreter.
Starting Jupyter from ~\AppData\Local\Continuum\anaconda3\python.exe
[I 17:11:35.687 NotebookApp] Writing notebook server cookie secret to C:\Users\cgardner\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
[I 17:11:36.063 NotebookApp] The port 8888 is already in use, trying another port.
[I 17:11:36.119 NotebookApp] JupyterLab extension loaded from C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab
[I 17:11:36.119 NotebookApp] JupyterLab application directory is C:\Users\cgardner\AppData\Local\Continuum\anaconda3\share\jupyter\lab
[I 17:11:36.123 NotebookApp] Serving notebooks from local directory: C:\Users\cgardner\AppData\Local\Temp\3e27a417-76ea-4ffb-b0a2-2343ab0a4f4e
[I 17:11:36.123 NotebookApp] The Jupyter Notebook is running at:
[I 17:11:36.123 NotebookApp] http://localhost:8889/?token=5567e0a665abc1a54c9f881c9033b72658d6e4d525a5a08c
[I 17:11:36.123 NotebookApp] or http://127.0.0.1:8889/?token=5567e0a665abc1a54c9f881c9033b72658d6e4d525a5a08c
[I 17:11:36.123 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:11:36.131 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/cgardner/AppData/Roaming/jupyter/runtime/nbserver-1512-open.html
Or copy and paste one of these URLs:
http://localhost:8889/?token=5567e0a665abc1a54c9f881c9033b72658d6e4d525a5a08c
or http://127.0.0.1:8889/?token=5567e0a665abc1a54c9f881c9033b72658d6e4d525a5a08c
[I 17:11:36.896 NotebookApp] Creating new notebook in /
[E 17:11:36.966 NotebookApp] Uncaught exception POST /api/sessions?1581977496928 (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8889', method='POST', uri='/api/sessions?1581977496928', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\cgardner\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\cgardner\\AppData\\Roaming\\jupyter\\runtime\\kernel-e38db9cb-f113-4f0e-8703-2930a39a485d.json'
[W 17:11:36.970 NotebookApp] Unhandled error
[E 17:11:36.970 NotebookApp] {
"Content-Type": "application/json",
"Authorization": "token 5567e0a665abc1a54c9f881c9033b72658d6e4d525a5a08c",
"Accept": "*/*",
"Content-Length": "157",
"User-Agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
"Accept-Encoding": "gzip,deflate",
"Connection": "close",
"Host": "localhost:8889"
}
[E 17:11:36.970 NotebookApp] 500 POST /api/sessions?1581977496928 (127.0.0.1) 37.90ms referer=None
This bug might be related to this: https://discourse.jupyter.org/t/jupyter-core-4-6-2-release-with-insure-mode-option/3300
You could try setting the JUPYTER_ALLOW_INSECURE_WRITES variable globally (or in whatever you start VS code from) to see if the problem goes away
@rchiodo Thanks, but that seems to be for non-windows environments, which doesn't apply to me.
@chadwgardner do you have access to this file?
C:\\Users\\cgardner\\AppData\\Roaming\\jupyter\\runtime\\kernel-e38db9cb-f113-4f0e-8703-2930a39a485d.json
@rchiodo I have full permissions on the directory, but not to that file (only admins do).
Hmm...so just trying to start a Jupyter server from my anaconda prompt also produces the same error....so I'm beginning to think this isn't specific to VS Code.
Hi guys, similar issue here. I'm on a macos and installed jupyterlab with pip.
I tried @NicoZing tip:
Hi @bigrat911 in my case I had similar issue with Jupyter server and it worked well by doing: 1º Start new .ipynd notebook in Vs 2º Ctrl+shift + P >> Python: Specify local or remote server for connections 3º Default 4º Run some code.
Basically I changed the server and worked well.
Hope this will be helpfull.
After running, a password prompt shows up and just press enter. Then I get the following error:
Error: Failed to connect to Jupyter notebook. http://localhost:8888/ Error: Invalid response: 400 Bad Request at /Users/raulvalenzuela/.vscode/extensions/ms-python.python-2020.2.64397/out/client/extension.js:1:817436
@rvalenzuelar Password prompt likely means you need a password. I'm not sure what setup you picked though.
Are you running your own jupyter server? Or did you pick the 'default' option in the 'Specify local or remote server for connections'. Never seen a case where we'd prompt for a password for default. That should be controlled by the jupyter config (which we generate as empty).
Thanks for the rapid response @rchiodo. I picked up the 'default' option in the 'Specify ...' I also find odd this password prompt, I have not set up anything with password. I'm using a local notebook as well.
First can you reload VS code and see if it repros again?
If it does, can you go to 'Help | Toggle Developer Tools`, click on the console tab, right click, save as, and upload the log here?
Thanks.
Here is my log -1582919001026.log
By the way, jupyter works fine if I start it from the terminal.
It's running this command here:
~/miniconda2/bin/python -m jupyter notebook --no-browser --notebook-dir=/var/folders/vm/z3qjj0q5191fgbd8pxr9y6_w0000gn/T/9c1f17cd-3e57-4adb-b5ed-f71b95a1579b --config=/var/folders/vm/z3qjj0q5191fgbd8pxr9y6_w0000gn/T/9c1f17cd-3e57-4adb-b5ed-f71b95a1579b/jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0
For some reason that's asking for a password. The config file usually dictates that, but maybe that version of jupyter is somehow configured to ignore the config file (or the config file path is invalid).
Also do you expect it to be using minconda2/bin/python? Is that normally where you run jupyter from? (This can be changed with the 'Python: Select jupyter interpreter' command.
Thanks @rchiodo. I tried 'Python: Select jupyter interpreter' and it did not work the first time but now the notebook is working. Maybe it needed a VS restart.
PD: in macos the command is 'Python: Select interpreter to start Jupyter server'
Thanks for the info. I think we still have some kinks to work out around picking/finding the correct python to use to start Jupyter.
Hi, I can't edit/save/run my jupyter notebook. Does somebody have any idea about this trouble? Version:
Error Python Extension: 2020-03-13 03:14:19: DataScience Error [Error: Activating Python 3.7.6 64-bit ('envr': conda) to run Jupyter failed with Error: Command failed: C:/Users/raige/Anaconda3/Scripts/activate && conda activate envr && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/raige/.vscode/extensions/ms-python.python-2020.2.64397/pythonFiles/printEnvVariables.pyPython was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640. at A.checkUsable (c:\Users\raige.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:794715)]
@fronos that sounds like your conda environment is not putting python on the path when being activated. I'd try just 'Python: Create Terminal' and see if you get the same issue.
There is an answer with many screen shots that worked to me https://stackoverflow.com/questions/60330837/jupyter-server-not-started-no-kernel-in-vs-code/60687169#60687169
I have same problem. I solved it by change from Anaconda3 4.2.0(python 3.5) to Anaconda3 python 3.7. Try more: Launch Visual Code from Anaconda Navigator. Select Interpreter. It's worked.
Bug: Notebook Editor, Interactive Window, Editor cells
Steps to cause the bug to occur
Actual behavior
Jupyter Server: No Kernel Python: Not Started Error: [Errno 13] Permission denied: '/Users/XXXXX/Library/Jupyter/kernels/python37364bitbasecondac02285ab1a5b43e69345d43980645608' Perhaps you want
sudo
or--user
?Expected behavior
Jupyter Server worked well
Your Jupyter and/or Python environment
Please provide as much info as you readily know
Developer Tools Console Output
Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer