WolframResearch / WolframLanguageForJupyter

Wolfram Language kernel for Jupyter notebooks
MIT License
1.05k stars 126 forks source link

Fail to launch the kernel in VSCode #97

Closed kenkangxgwe closed 2 years ago

kenkangxgwe commented 4 years ago

I couldn't start the Wolfram Engine / MMA kernel in VSCode but I successfully started it and evaluated code pieces in a browser.

The output from vscode:

> pyenv root
Error 2020-08-16 19:59:48: Failed to get interpreter information for 'C:\Program Files\Wolfram Research\Mathematica\12.1\wolfram.exe' [Error: Command failed: "C:\\Program Files\Wolfram Research\Mathematica\12.1\wolfram.exe" "c:\Users\kenkangxgwe\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py" "c:\Users\kenkangxgwe\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\interpreterInfo.py"

    at ChildProcess.exithandler (child_process.js:308:12)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)] {
  killed: true,
  code: null,
  signal: 'SIGTERM',
  cmd: '"C:\\\\Program Files\\Wolfram Research\\Mathematica\\12.1\\wolfram.exe" "c:\\Users\\kenkangxgwe\\.vscode\\extensions\\ms-python.python-2020.8.101144\\pythonFiles\\pyvsc-run-isolated.py" "c:\\Users\\kenkangxgwe\\.vscode\\extensions\\ms-python.python-2020.8.101144\\pythonFiles\\interpreterInfo.py"'
}
Error 2020-08-16 19:59:48: KernelSpec has interpreter information, however a matching interepter could not be found for undefined
> ~\scoop\apps\python\current\python.exe c:\Users\kenkangxgwe\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> ~\scoop\apps\python\current\python.exe c:\Users\kenkangxgwe\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> C:\Program Files\Wolfram Research\Mathematica\12.1\wolfram.exe -script D:\Projects\WolframLanguageForJupyter\WolframLanguageForJupyter\Resources\KernelForWolframLanguageForJupyter.wl C:\Users\KENKAN~1\AppData\Local\Temp\tmp-188160kXEUEUBX40W.json ScriptInstall
Error 2020-08-16 20:00:18: Timed out waiting to get a heartbeat from kernel process.

Not sure if it is a vscode problem or not? Post it here first. Thanks

cc-wr commented 3 years ago

@kenkangxgwe, sorry, can you give more information about what you are trying to accomplish, what you have tried, what you are trying now, and what output you have received? I do not fully understand the scenario.

asukaminato0721 commented 3 years ago

I select 11.3 image and run some cmd.

image

return a timeout.

jupyter                       1.0.0
jupyter-client                6.1.7
jupyter-console               6.2.0
jupyter-core                  4.6.3
lyyc199586 commented 3 years ago

Same question here!

kenkangxgwe commented 3 years ago

@cc-wr , It's basically about using the Jupyter extension in VS Code to start Wolfram Kernel. Could you verify that it is working on your side? Thanks

The3DWizard commented 3 years ago

As far as I know VSCode currently only supports this functionality (non-python kernels in jupyter notebooks) in the insiders build. The standard version does not yet support it.

ezrark commented 3 years ago

I'm getting this same issue using VSCode Insiders 1.55.0 on the experimental (insiders) Jupyter notebook system. I'm trying to run Wolfram Langauage 12.2 on Arch Linux. Same error timed out waiting to get a heartbeat from kernel process. Log from Jupyter is pasted below

Info 2021-03-12 00:54:13: Execute Cell 0 vscode-notebook-cell:/home/ezra/Documents/MATS_S21/Diffusion/HW6/q3.ipynb#ch0000000 in kernelWithMetadata.ts
Info 2021-03-12 00:54:13: Starting Notebook in kernel.ts id = .wolframlanguage12.2./usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel..Wolfram Language 12.2
Info 2021-03-12 00:54:13: Cell Index:0, state:2, exec: undefined. User queued cell for execution
Info 2021-03-12 00:54:13: Cell Index:0, state:2, exec: undefined. Update cell state as it was enqueued
Info 2021-03-12 00:54:13: Creating raw notebook for file:///home/ezra/Documents/MATS_S21/Diffusion/HW6/q3.ipynb
Info 2021-03-12 00:54:13: Getting preferred kernel for file:///home/ezra/Documents/MATS_S21/Diffusion/HW6/q3.ipynb
Info 2021-03-12 00:54:13: Computing working directory file:///home/ezra/Documents/MATS_S21/Diffusion/HW6/q3.ipynb
Info 2021-03-12 00:54:13: Connecting to raw session for file:///home/ezra/Documents/MATS_S21/Diffusion/HW6/q3.ipynb with connection {"kind":"startUsingKernelSpec","kernelSpec":{"specFile":"/home/ezra/.local/share/jupyter/kernels/wolframlanguage12.2/kernel.json","name":"wolframlanguage12.2","argv":["/usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel","-script","/home/ezra/Downloads/WolframLanguageForJupyter/WolframLanguageForJupyter/Resources/KernelForWolframLanguageForJupyter.wl","{connection_file}","ScriptInstall"],"language":"Wolfram Language","path":"/usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel","display_name":"Wolfram Language 12.2"},"id":".wolframlanguage12.2./usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel..Wolfram Language 12.2"}
Info 2021-03-12 00:54:13: Starting raw kernel Wolfram Language 12.2
Info 2021-03-12 00:54:13: Kernel launching with ports 9016,9017,9018,9019,9020. Start port is 9000
Info 2021-03-12 00:54:13: Launching Raw Kernel & not daemon Wolfram Language 12.2 # /usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel
Info 2021-03-12 00:54:13: Cached data exists getEnvironmentVariables, /home/ezra/Documents/MATS_S21/Diffusion/HW6/q3.ipynb
Info 2021-03-12 00:54:13: No custom variables for Kernel as interpreter path is not defined for kernel Wolfram Language 12.2
Info 2021-03-12 00:54:13: Process Execution: > /usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel -script ~/Downloads/WolframLanguageForJupyter/WolframLanguageForJupyter/Resources/KernelForWolframLanguageForJupyter.wl /tmp/tmp-379358mWA5v71puTOc.json ScriptInstall
> /usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel -script ~/Downloads/WolframLanguageForJupyter/WolframLanguageForJupyter/Resources/KernelForWolframLanguageForJupyter.wl /tmp/tmp-379358mWA5v71puTOc.json ScriptInstall
Info 2021-03-12 00:54:13: Process Execution: cwd: ~/Documents/MATS_S21/Diffusion/HW6
cwd: ~/Documents/MATS_S21/Diffusion/HW6
Info 2021-03-12 00:54:13: Launching kernel in kernelProcess.ts, Class name = _, completed in 7ms, has a truthy return value, Arg 1: "/home/ezra/Documents/MATS_S21/Diffusion/HW6", Return Value: {"proc":{"_events":{},"_eventsCount":0,"_closesNeeded":3,"_closesGot":0,"connected":false,"signalCode":null,"exitCode":null,"killed":false,"spawnfile":"/usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel","_handle":{"pid":383306},"spawnargs":["/usr/local/Wolfram/Mathematica/12.2/Executables/WolframKernel","-script","/home/ezra/Downloads/WolframLanguageForJupyter/WolframLanguageForJupyter/Resources/KernelForWolframLanguageForJupyter.wl","/tmp/tmp-379358mWA5v71puTOc.json","ScriptInstall"],"pid":383306,"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-12 00:55:13: Disposing kernel process due to an error [Error: timeout
    at Timeout.<anonymous> (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:630016)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)]
Info 2021-03-12 00:55:13: Dispose Kernel process
Error 2021-03-12 00:55:13: Timed out waiting to get a heartbeat from kernel process.
Error 2021-03-12 00:55:13: Raw session failed to start in given timeout
Info 2021-03-12 00:55:13: Shutdown session -- complete
Error 2021-03-12 00:55:13: failed to create INotebook in kernel, UI Disabled = false [b [Error]: 
    at new t.WrappedError (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:16:22008)
    at new b (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:32:534378)
    at w.connect (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:32:536238)
    at async b.createNotebookInstance (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:810657)

Error: Timed out waiting to get a heartbeat from kernel process. 
jupyter.viewOutput 
View Jupyter [log](command:{1}) for further details.
    at _.launch (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:624875)] {
  category: 'timeout',
  originalException: [i [Error]: Timed out waiting to get a heartbeat from kernel process. 
  jupyter.viewOutput 
  View Jupyter [log](command:{1}) for further details.
    at _.launch (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:624875)] {
    category: 'timeout'
  }
}
Error 2021-03-12 00:55:13: DataScience Error [i [Error]: Timed out waiting to get a heartbeat from kernel process. 
jupyter.viewOutput 
View Jupyter [log](command:{1}) for further details.
    at _.launch (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:624875)] {
  category: 'timeout'
}
Error 2021-03-12 00:55:13: failed to start INotebook in kernel, UI Disabled = false [b [Error]: 
    at new t.WrappedError (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:16:22008)
    at new b (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:32:534378)
    at w.connect (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:32:536238)
    at async b.createNotebookInstance (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:810657)

Error: Timed out waiting to get a heartbeat from kernel process. 
jupyter.viewOutput 
View Jupyter [log](command:{1}) for further details.
    at _.launch (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:624875)] {
  category: 'timeout',
  originalException: [i [Error]: Timed out waiting to get a heartbeat from kernel process. 
  jupyter.viewOutput 
  View Jupyter [log](command:{1}) for further details.
    at _.launch (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:624875)] {
    category: 'timeout'
  }
}
Error 2021-03-12 00:55:13: Failed to execute cells in CellExecutionQueue [b [Error]: 
    at new t.WrappedError (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:16:22008)
    at new b (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:32:534378)
    at w.connect (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:32:536238)
    at async b.createNotebookInstance (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:810657)

Error: Timed out waiting to get a heartbeat from kernel process. 
jupyter.viewOutput 
View Jupyter [log](command:{1}) for further details.
    at _.launch (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:624875)] {
  category: 'timeout',
  originalException: [i [Error]: Timed out waiting to get a heartbeat from kernel process. 
  jupyter.viewOutput 
  View Jupyter [log](command:{1}) for further details.
    at _.launch (/home/ezra/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/out/client/extension.js:49:624875)] {
    category: 'timeout'
  }
}
Info 2021-03-12 00:55:13: Cancel pending cells
Info 2021-03-12 00:55:13: Cell Index:0, state:1, exec: undefined. Execution cancelled
Info 2021-03-12 00:55:13: Cell Index:0, state:1, exec: undefined. Completed due to cancellation
Info 2021-03-12 00:55:13: Cell Index:0, state:1, exec: undefined. Update cell statue as idle and message as empty
Info 2021-03-12 00:55:13: KernelProcess error: terminate called after throwing an instance of 'zmq::error_t'
  what():  Interrupted system call

Warn 2021-03-12 00:55:13: StdErr from Kernel Process terminate called after throwing an instance of 'zmq::error_t'
  what():  Interrupted system call

Info 2021-03-12 00:55:13: Cell Index:0, state:2, exec: undefined. Cell cancelled & resolving
Info 2021-03-12 00:55:13: Cell Index:0, state:2, exec: undefined. Execution disposed
Info 2021-03-12 00:55:15: KernelProcess Exit Exit - undefined terminate called after throwing an instance of 'zmq::error_t'
  what():  Interrupted system call
kands-code commented 2 years ago

Is there any solution now? I can't even find this kernel in vscode Jupyter.

image

But I can use this kernel in jupyter notebook (or lab).

image

kenkangxgwe commented 2 years ago

For future readers who are interested in using Wolfram Notebook in VSCode, please take a look at https://github.com/njpipeorgan/wolfram-language-notebook.