Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot execute Python/Jupyter code - Need troubleshooting tool or guide. #5361

Closed
Tracked by #6188
chrisdias opened this issue Mar 30, 2021 · 11 comments
Closed
Tracked by #6188
Labels
debt Code quality issues documentation notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel)

Comments

@chrisdias
Copy link
Member

Environment data

  • VS Code version: XXX
Version: 1.55.0-insider (user setup)
Commit: c185983a683d14c396952dd432459097bc7f757f
Date: 2021-03-30T12:48:52.547Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19041
  • Jupyter Extension version (available under the Extensions sidebar): XXX
  • Python Extension version (available under the Extensions sidebar): XXX

image

  • OS (Windows | Mac | Linux distro) and version: Windows + WSL (Ubuntu 20.04)
  • Python and/or Anaconda version: XXX
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): XXX
  • Jupyter server running: Local | Remote | N/A

Can't run even a simple Python cell in Jupyter (native notebook)

Dev Tools Console:

image

Steps to reproduce:

  • New notebook
  • New Code Cell
print("hello world")
  • Press run button

Results:

  • Sometimes I get the "Connecting to kernel: Python 3" message, sometimes nothing

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'jupyterTestcf'
User belongs to experiment group 'pythonDiscoveryModule'
User belongs to experiment group 'pythonFindInterpreter'
User belongs to experiment group 'NativeNotebookEditor'
Info 2021-03-30 12:56:31: ZMQ install verified.
Info 2021-03-30 12:56:31: Attempting to start a server because of preload conditions ...
Info 2021-03-30 12:56:31: Found existing keyfile at /home/chrisdias/.vscode-server-insiders/data/User/globalStorage/ms-toolsai.jupyter/nbsecret
Info 2021-03-30 12:56:32: Checking if notebook is trusted
Info 2021-03-30 12:56:32: Check if Notebook is Trusted, Class name = p, completed in 74ms, has a truthy return value, Return Value: true
Info 2021-03-30 12:56:33: Attempting to start a server because of preload conditions ...
Info 2021-03-30 12:56:33: Search all interpreters /bin/python2, /bin/python3, /usr/bin/python2, /usr/bin/python3
Info 2021-03-30 12:56:34: Loading kernelspec from /home/chrisdias/.local/share/jupyter/kernels/python3/kernel.json for undefined
Info 2021-03-30 12:56:34: findPreferredKernel score for Python 3 is 15
Info 2021-03-30 12:56:34: findPreferredKernel score for Python 2.7.18 64-bit is 1
Info 2021-03-30 12:56:34: findPreferredKernel score for Python 3.8.5 64-bit is 1
Info 2021-03-30 12:56:34: findPreferredKernel score for Python 2.7.18 64-bit is 1
Info 2021-03-30 12:56:34: findPreferredKernel score for Python 3.8.5 64-bit is 1
Info 2021-03-30 12:56:34: Find kernel spec, Class name = D, completed in 4ms, has a truthy return value, Arg 1: <Uri:/home/chrisdias/src/mvpSummit2021/wa_state_covid.ipynb>, Arg 2: {"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":""},"orig_nbformat":2}, Arg 3: {"_isCancelled":false,"_emitter":null}, Return Value: {"kind":"startUsingKernelSpec","kernelSpec":{"specFile":"/home/chrisdias/.local/share/jupyter/kernels/python3/kernel.json","name":"python3","argv":["python","-m","ipykernel_launcher","-f","{connection_file}"],"language":"python","path":"python","display_name":"Python 3"},"id":".python3.python..Python 3"}
Info 2021-03-30 12:56:34: KernelProvider switched kernel to id = .python3.python..Python 3}
Info 2021-03-30 12:56:34: Starting Notebook in kernel.ts id = .python3.python..Python 3
Info 2021-03-30 12:56:34: Creating raw notebook for file:///home/chrisdias/src/mvpSummit2021/wa_state_covid.ipynb
Info 2021-03-30 12:56:34: Getting preferred kernel for file:///home/chrisdias/src/mvpSummit2021/wa_state_covid.ipynb
Info 2021-03-30 12:56:34: Computing working directory file:///home/chrisdias/src/mvpSummit2021/wa_state_covid.ipynb
Info 2021-03-30 12:56:34: Connecting to raw session for file:///home/chrisdias/src/mvpSummit2021/wa_state_covid.ipynb with connection {"kind":"startUsingKernelSpec","kernelSpec":{"specFile":"/home/chrisdias/.local/share/jupyter/kernels/python3/kernel.json","name":"python3","argv":["python","-m","ipykernel_launcher","-f","{connection_file}"],"language":"python","path":"python","display_name":"Python 3"},"id":".python3.python..Python 3"}
Info 2021-03-30 12:56:34: Starting raw kernel Python 3
Info 2021-03-30 12:56:34: Kernel launching with ports 9000,9001,9002,9003,9004. Start port is 9000
Info 2021-03-30 12:56:34: Launching kernel daemon for Python 3 # undefined
Info 2021-03-30 12:56:34: No custom variables for Kernel as interpreter path is not defined for kernel Python 3
Info 2021-03-30 12:56:34: Creating daemon process for python with env variables count 0
Info 2021-03-30 12:56:35: Process Execution: > python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Info 2021-03-30 12:56:35: Process Execution: > python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Error 2021-03-30 12:56:40: Failed to start the Daemon, StdErr:  
Error 2021-03-30 12:56:40: Failed to start the Daemon, ProcEndEx [Error: spawn python ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
	at onErrorNT (internal/child_process.js:469:16)
	at processTicksAndRejections (internal/process/task_queues.js:84:21)] {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn python',
  path: 'python',
  spawnargs: [
    '/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py',
    'vscode_datascience_helpers.daemon',
    '--daemon-module=vscode_datascience_helpers.kernel_launcher_daemon',
    '-v'
  ]
}
Error 2021-03-30 12:56:40: Failed  to start the Daemon, Ex [Error: Timeout waiting for daemon to start
	at Timeout._onTimeout (/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/out/client/extension.js:32:241494)
	at listOnTimeout (internal/timers.js:549:17)
	at processTimers (internal/timers.js:492:7)]
Error 2021-03-30 12:56:40: Pinging Daemon Failed, Class name = d, completed in 5006ms, has a falsy return value, Arg 1: {}, Return Value: undefined [Error: Timeout waiting for daemon to start
	at Timeout._onTimeout (/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/out/client/extension.js:32:241494)
	at listOnTimeout (internal/timers.js:549:17)
	at processTimers (internal/timers.js:492:7)]
Error 2021-03-30 12:56:40: Failed to create daemon, Class name = d, completed in 5091ms, has a falsy return value, , Return Value: undefined [Error: Timeout waiting for daemon to start
	at Timeout._onTimeout (/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/out/client/extension.js:32:241494)
	at listOnTimeout (internal/timers.js:549:17)
	at processTimers (internal/timers.js:492:7)]
Error 2021-03-30 12:56:40: Failed to create the daemon service, defaulting to activated environment [Error: Timeout waiting for daemon to start
	at Timeout._onTimeout (/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/out/client/extension.js:32:241494)
	at listOnTimeout (internal/timers.js:549:17)
	at processTimers (internal/timers.js:492:7)]
Info 2021-03-30 12:56:40: Process Execution: > python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"a189c17a-f76f-457b-9e8f-1ae84a0397a4" --shell=9002 --transport="tcp" --iopub=9004 --f=/tmp/tmp-22067vfLSwP3a1ABS.json
> python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"a189c17a-f76f-457b-9e8f-1ae84a0397a4" --shell=9002 --transport="tcp" --iopub=9004 --f=/tmp/tmp-22067vfLSwP3a1ABS.json
Info 2021-03-30 12:56:40: Process Execution: cwd: ~/src/mvpSummit2021
cwd: ~/src/mvpSummit2021
Info 2021-03-30 12:56:40: Process Execution: > python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"a189c17a-f76f-457b-9e8f-1ae84a0397a4" --shell=9002 --transport="tcp" --iopub=9004 --f=/tmp/tmp-22067vfLSwP3a1ABS.json
> python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"a189c17a-f76f-457b-9e8f-1ae84a0397a4" --shell=9002 --transport="tcp" --iopub=9004 --f=/tmp/tmp-22067vfLSwP3a1ABS.json
Info 2021-03-30 12:56:40: Process Execution: cwd: ~/src/mvpSummit2021
cwd: ~/src/mvpSummit2021
Info 2021-03-30 12:56:40: Launching kernel daemon, Class name = h, completed in 5695ms, has a truthy return value, Arg 1: <Uri:/home/chrisdias/src/mvpSummit2021/wa_state_covid.ipynb>, Arg 2: "/home/chrisdias/src/mvpSummit2021", Arg 3: {"specFile":"/home/chrisdias/.local/share/jupyter/kernels/python3/kernel.json","name":"python3","argv":["python","-m","ipykernel_launcher","--ip=127.0.0.1","--stdin=9003","--control=9001","--hb=9000","--Session.signature_scheme=\"hmac-sha256\"","--Session.key=b\"a189c17a-f76f-457b-9e8f-1ae84a0397a4\"","--shell=9002","--transport=\"tcp\"","--iopub=9004","--f=/tmp/tmp-22067vfLSwP3a1ABS.json"],"language":"python","path":"python","display_name":"Python 3"}, Arg 4: undefined, Return Value: {"observableOutput":{"proc":{"_events":{},"_eventsCount":0,"_closesNeeded":3,"_closesGot":0,"connected":false,"signalCode":null,"exitCode":null,"killed":false,"spawnfile":"python","_handle":{},"spawnargs":["python","/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py","ipykernel_launcher","--ip=127.0.0.1","--stdin=9003","--control=9001","--hb=9000","--Session.signature_scheme=\"hmac-sha256\"","--Session.key=b\"a189c17a-f76f-457b-9e8f-1ae84a0397a4\"","--shell=9002","--transport=\"tcp\"","--iopub=9004","--f=/tmp/tmp-22067vfLSwP3a1ABS.json"],"stdin":{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":false,"_events":{},"_eventsCount":1,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":true,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},"stdout":{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":true,"sync":false,"needReadable":true,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"_events":{},"_eventsCount":2,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":false,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},"stderr":{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":true,"sync":false,"needReadable":true,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"_events":{},"_eventsCount":2,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":false,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},"stdio":[{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":false,"_events":{},"_eventsCount":1,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":true,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":true,"sync":false,"needReadable":true,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"_events":{},"_eventsCount":2,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":false,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":true,"sync":false,"needReadable":true,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"_events":{},"_eventsCount":2,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":false,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null}]},"out":{"_isScalar":false}}}
Info 2021-03-30 12:56:40: Launching kernel in kernelProcess.ts, Class name = _, completed in 5696ms, has a truthy return value, Arg 1: "/home/chrisdias/src/mvpSummit2021", Return Value: {"proc":{"_events":{},"_eventsCount":0,"_closesNeeded":3,"_closesGot":0,"connected":false,"signalCode":null,"exitCode":null,"killed":false,"spawnfile":"python","_handle":{},"spawnargs":["python","/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py","ipykernel_launcher","--ip=127.0.0.1","--stdin=9003","--control=9001","--hb=9000","--Session.signature_scheme=\"hmac-sha256\"","--Session.key=b\"a189c17a-f76f-457b-9e8f-1ae84a0397a4\"","--shell=9002","--transport=\"tcp\"","--iopub=9004","--f=/tmp/tmp-22067vfLSwP3a1ABS.json"],"stdin":{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":false,"_events":{},"_eventsCount":1,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":true,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},"stdout":{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":true,"sync":false,"needReadable":true,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"_events":{},"_eventsCount":2,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":false,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},"stderr":{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":true,"sync":false,"needReadable":true,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"_events":{},"_eventsCount":2,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":false,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},"stdio":[{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":false,"_events":{},"_eventsCount":1,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":true,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":true,"sync":false,"needReadable":true,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"_events":{},"_eventsCount":2,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":false,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null},{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":true,"sync":false,"needReadable":true,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"_events":{},"_eventsCount":2,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":true,"bufferProcessing":false,"writecb":null,"writelen":0,"afterWriteTickInfo":null,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":0,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":false,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null}]},"out":{"_isScalar":false}}
Error 2021-03-30 12:56:40: Kernel died [Error: spawn python ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
	at onErrorNT (internal/child_process.js:469:16)
	at processTicksAndRejections (internal/process/task_queues.js:84:21)] {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn python',
  path: 'python',
  spawnargs: [
    '/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py',
    'ipykernel_launcher',
    '--ip=127.0.0.1',
    '--stdin=9003',
    '--control=9001',
    '--hb=9000',
    '--Session.signature_scheme="hmac-sha256"',
    '--Session.key=b"a189c17a-f76f-457b-9e8f-1ae84a0397a4"',
    '--shell=9002',
    '--transport="tcp"',
    '--iopub=9004',
    '--f=/tmp/tmp-22067vfLSwP3a1ABS.json'
  ]
} 

XXX

@chrisdias chrisdias added the bug Issue identified by VS Code Team member as probable bug label Mar 30, 2021
@IanMatthewHuff IanMatthewHuff self-assigned this Mar 31, 2021
@IanMatthewHuff
Copy link
Member

@chrisdias Using this same python environment can you just run something like a simple .py script in the terminal? This popped up in the log:

Error 2021-03-30 12:56:40: Failed to start the Daemon, ProcEndEx [Error: spawn python ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21)] { errno: 'ENOENT', code: 'ENOENT', syscall: 'spawn python', path: 'python', spawnargs: [ '/home/chrisdias/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.5.700832604/pythonFiles/pyvsc-run-isolated.py', 'vscode_datascience_helpers.daemon', '--daemon-module=vscode_datascience_helpers.kernel_launcher_daemon', '-v' ]

That looks like the python interpreter that you had selected on WSL might not be working at all. It's failing to just run python period.

@chrisdias
Copy link
Member Author

~/src/mvpSummit2021 $ python
zsh: command not found: python
~/src/mvpSummit2021 $ python3
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
~/src/mvpSummit2021 $ which python3
/usr/bin/python3
~/src/mvpSummit2021 $

And the Python Kernel is the same python3

image

@chrisdias
Copy link
Member Author

I noticed (ps aux) that I had a number (> 5) of separate ipykernel_launcher processes running and then killed them all. After doing that, it seems like it is working properly again.

There is still a problem where if I have the (I think) default python kernel selected, when I press run on the cell the very first time I don't see the "Connecting to kernel: Python 3" message. If I try to stop the run, the subsequent time I will see the message, but it eventually times out.

@greazer greazer added this to the May 2021 Release milestone Apr 1, 2021
@IanMatthewHuff
Copy link
Member

So is that Python 3 (python) entry in the middle of your list the one that is still giving issues? Our kernel launching code should not actually install any kernel specs on a system. But it looks like there is a default kernel spec located there. Have you run Jupyter Notebook (classic or JupyterLab, not via VS Code) on this system? The kernel spec there is an invalid kernelspec and I'm interested in how it got installed. I can tell from the logging that it's located in the following spot.

"kernelSpec":{"specFile":"/home/chrisdias/.local/share/jupyter/kernels/python3/kernel.json","name":"python3","argv":["python","-m","ipykernel_launcher","-f","{connection_file}"],"language":"python","path":"python","display_name":"Python 3"}

The issue that you are seeing looks very similar to this:
jupyter/jupyter#270 (comment)
Looks like when creating a default kernel Jupyter can point at the wrong thing. This kernelspec has been created and is pointing at python instead of python3 which is what your system needs. Seems like from that Jupyter thread that I linked and this issue here it might be a pretty general problem.

jupyter/notebook#2563 (comment)

I'm not sure if we can totally fix this on our end. If there is an invalid kernelspec on a system then we won't be able to use it. However our messaging of the failure is terrible here. So at a minimum we should message better to the user what is happening here with the spawn failure.

To fix it now though I think that you'd need to either edit the kernelspec to point at python3 or try the ipython command in that second link that I posted above.

@IanMatthewHuff IanMatthewHuff removed their assignment Apr 2, 2021
@chrisdias
Copy link
Member Author

Yes, the one in the middle is the one that does not work and just hangs. Is the "kernel spec" the kernel.json? If so, it looks like the one in the linked issue:

~/.local/share/jupyter/kernels/python3 $ cat kernel.json
{
 "argv": [
  "python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}          

I don't recall changing the kernel being pointed to, nor do I recall installing anything else besides Python in this WSL image (Ubuntu 20.04). It just stopped working.

@IanMatthewHuff
Copy link
Member

@chrisdias yeah, we list both python interpreter and installed kernelspecs on your system as possible kernels to use. That middle entry is a kernelspec that has been installed on your machine. Have you run jupyter from the command line on WSL? Running that installs a default kernel on the system without notification. That was my suspicion on where that spec came from.

@chrisdias
Copy link
Member Author

any idea how i might know if i ran jupyter from the command line?

@IanMatthewHuff
Copy link
Member

IanMatthewHuff commented Apr 6, 2021

Is this WSL instance something that you have had around for a long time? Something like jupyter notebook from the command line at any point would have installed this kernelspec. From your log it looks like the Jupyter extension is using ZMQ, which means that Jupyter extension should not have installed the jupyter package and we would not install any kernelspecs.
Info 2021-03-30 12:56:31: ZMQ install verified.
You could check the date on the file to see how long it's been there for? Also if your python environment has the jupyter package installed in it that would presumably be from installing jupyter manually before.

At this point the easiest thing might be to just delete that kernelspec. We can see if anything regenerates it. Regardless of how it got there we do still have an issue to fix on our side. Better messaging regarding the kernelspec failure at a minimum. Also in the specific case of python we could check to see if it's even present and then try python3 if it's not.

@chrisdias
Copy link
Member Author

chrisdias commented Apr 6, 2021

ok i deleted it and i'll keep an eye out for changes.

i feel like a diagnostic tool for the kernels might be helpful... Imagine you run a command Jupyter: Validate Kernels which would "profile" each discovered kernelspec and generate a report that could be uploaded along with an issue.

Something like this (completely made up Status :) would have helped me pinpoint the problem, assuming you could run some sort of diagnostics against them.

Kernel Platform Location Status
Python 2.7.18 64-bit /bin/python2 OK
Python 2.7.18 64-bit /usr/bin/python2 OK
Python 3 unknown python FAIL Could not find python
Python 3.8.5 64-bit /bin/python3 OK
Python 3.8.5 64-bit /usr/bin/python3 OK

@IanMatthewHuff
Copy link
Member

@chrisdias Yeah that's a good suggestion. If a customer has an invalid kernelspec we wouldn't want to just hide it from them. As they would be annoyed as to why they didn't see it at all. But even before they try to launch we should be able to tell them that it's not valid. Instead of a status step we could maybe just flag it in the kernelspec quick pick with an error / warning icon of some type. And if they pick it pop up the info on why we can't launch it.

We did have old code paths that would have installed a kernelspec, they shouldn't be hit, but if you do see that bad default kernelspec back just ping and we can dig in.

@greazer greazer added the notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) label Apr 26, 2021
@greazer greazer modified the milestones: May 2021 Release, June 2021 Release Apr 26, 2021
@greazer greazer changed the title Cannot execute Python/Jupyter code Cannot execute Python/Jupyter code - Need troubleshooting tool or guide. Apr 26, 2021
@greazer greazer added debt Code quality issues documentation and removed bug Issue identified by VS Code Team member as probable bug enhancement labels Aug 3, 2021
@DonJayamanne
Copy link
Contributor

Duplicate of #5291

@DonJayamanne DonJayamanne marked this as a duplicate of #5291 Oct 18, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues documentation notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel)
Projects
None yet
Development

No branches or pull requests

4 participants