vscode-jupyter
vscode-jupyter copied to clipboard
With Remote SSH, Notebook cells are not executed sequentially
Applies To
- [X] Notebooks (.ipynb files)
- [ ] Interactive Window and/or Cell Scripts (.py files with #%% markers)
What happened?
With Remote - SSH extension and connecting to a server (which maybe slow to respond), and when pressing "Run All" or "Execute Cell and Below" button, the notebook cells are not executed sequentially.
This behavior does not reproduce in local, so it may be specific to Remote-SSH. Also, the server I am connected to via SSH has relatively low computational resources and is slow to respond, so I suspect this might be the cause.
Explanation of the Attached Log
This log is from when the "Run All" button was pressed three times. Each time the button is pressed, the order in which the cells are executed changes. The first time, it started executing from Cell 1, resulting in a NameError. The second time, it executed correctly in the order of Cell 0 -> 1 -> 2. The third time, it executed in the order of Cell 0 -> 2 -> 1.
Here is screenshot of the notebook I used in this experiment, after the last execution.
VS Code Version
1.89.1
Jupyter Extension Version
Greater than or equal to 2024.2.0. This is not reproduced in 2024.1.1.
Jupyter logs
23:36:02.298 [info] Restart requested ~/vscode_jupyter_not_sequential.ipynb
23:36:02.298 [info] Check & install missing Kernel dependencies for /opt/conda/bin/python, ui.disabled=false for resource '~/vscode_jupyter_not_sequential.ipynb'
23:36:02.324 [info] Process Execution: /opt/conda/bin/python -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
23:36:02.727 [info] Restarted 247beb75-4ffb-4bdd-b198-9c20f726c975
23:36:10.249 [info] Handle Execution of Cells 0,1,2,3 for ~/vscode_jupyter_not_sequential.ipynb
23:36:10.312 [warn] Cell completed with errors hd [Error]: name 'time' is not defined
at r.execute (/~/workspace/.vscode-server/extensions/ms-toolsai.jupyter-2024.4.0/dist/extension.node.js:311:4943)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
ename: 'NameError',
evalue: "name 'time' is not defined",
traceback: [
'\x1B[0;31m---------------------------------------------------------------------------\x1B[0m',
'\x1B[0;31mNameError\x1B[0m Traceback (most recent call last)',
'\x1B[0;32m/tmp/ipykernel_17926/3656970592.py\x1B[0m in \x1B[0;36m<cell line: 1>\x1B[0;34m()\x1B[0m\n' +
'\x1B[0;32m----> 1\x1B[0;31m \x1B[0mtime\x1B[0m\x1B[0;34m.\x1B[0m\x1B[0msleep\x1B[0m\x1B[0;34m(\x1B[0m\x1B[0;36m1\x1B[0m\x1B[0;34m)\x1B[0m\x1B[0;34m,\x1B[0m \x1B[0;36m1\x1B[0m\x1B[0;34m+\x1B[0m\x1B[0;36m1\x1B[0m\x1B[0;34m\x1B[0m\x1B[0;34m\x1B[0m\x1B[0m\n' +
'\x1B[0m',
"\x1B[0;31mNameError\x1B[0m: name 'time' is not defined"
]
}
23:36:10.315 [info] Cell 1 completed in 0.038s (start: 1717598170274, end: 1717598170312)
23:36:10.316 [warn] Cancel all remaining cells due to cancellation or failure in execution
23:36:10.316 [info] Cell 0 completed in 0s (start: undefined, end: undefined)
23:36:10.316 [info] Cell 2 completed in 0s (start: undefined, end: undefined)
23:36:10.316 [info] Cell 3 completed in 0s (start: undefined, end: undefined)
23:36:17.805 [info] Handle Execution of Cells 0,1,2,3 for ~/vscode_jupyter_not_sequential.ipynb
23:36:17.830 [info] Cell 0 completed in 0.001s (start: 1717598177829, end: 1717598177830)
23:36:18.840 [info] Cell 1 completed in 1.007s (start: 1717598177833, end: 1717598178840)
23:36:19.347 [info] Cell 2 completed in 0.503s (start: 1717598178844, end: 1717598179347)
23:36:19.348 [info] Cell 3 completed in 0s (start: undefined, end: undefined)
23:36:20.642 [info] Handle Execution of Cells 0,1,2,3 for ~/vscode_jupyter_not_sequential.ipynb
23:36:21.164 [info] Cell 2 completed in 0.504s (start: 1717598180660, end: 1717598181164)
23:36:21.210 [info] Cell 0 completed in 0.041s (start: 1717598181169, end: 1717598181210)
23:36:22.218 [info] Cell 1 completed in 1.002s (start: 1717598181215, end: 1717598182217)
23:36:22.218 [info] Cell 3 completed in 0s (start: undefined, end: undefined)
Coding Language and Runtime Version
Python 3.9.15
Language Extension Version (if applicable)
No response
Anaconda Version (if applicable)
No response
Running Jupyter locally or remotely?
Remote