microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.33k stars 1.19k forks source link

Jupyter notebook extension on remote server does not work after VScode downgrade. #22865

Open amirhosseindavoody opened 9 months ago

amirhosseindavoody commented 9 months ago

Environment data

Expected behaviour

The jupyter notebook should autocomplete the variable names and show list of live variables.

Actual behaviour

None of the functionalities of jupyter notebook extensions for autocomplete and showing existing variables work.

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

I don't have exact instructions, but this happened when I had to revert back from vscode 1.86 release to 1.85.2 because of glibc version incompatibility on my remote machine. Then I found out that the extensions have been upgraded too. So, I reverted back the extensions to some previous version from back in November. The extensions I reverted are Jupyter notebook, pylance, and vscode-python. Now, none of the functionalities for jupyter notebook work. Python extension seems to work for now. I get autocomplete in .py files but nothing in .ipynb files.

I see this error when I look at the jupyter extension page:

image

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

``` Visual Studio Code (1.85.2, ssh-remote, desktop) Jupyter Extension Version: 2023.11.1003402403. Python Extension Version: 2023.20.0. Pylance Extension Version: 2023.11.10. Platform: linux (x64). Multiple Workspace folders opened /path/to/python/environment, path/to/jupyter/notebook 10:28:04.576 [info] Start refreshing Kernel Picker (1707157684576) 10:28:04.582 [info] Not using Pylance 10:28:05.473 [error] Failed to validate Password info [D [FetchError]: request to http://remote-server-ip:8888/tree? failed, reason: connect ECONNREFUSED 10.116.83.98:8888 at ClientRequest. (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/node-fetch.js:1:306417) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:502:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] { type: 'system', errno: 'ECONNREFUSED', code: 'ECONNREFUSED' } 10:28:05.509 [error] Error fetching kernels from http://remote-server-ip:8888/ (remote-server-ip): [FetchError: request to http://remote-server-ip:8888/api/kernels?1707157685499 failed, reason: connect ECONNREFUSED 10.116.83.98:8888 at ClientRequest. (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/node-fetch.js:1:306417) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:502:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] 10:28:05.510 [error] UniversalRemoteKernelFinder: Failed to get kernels without cache [FetchError: request to http://remote-server-ip:8888/api/kernels?1707157685499 failed, reason: connect ECONNREFUSED 10.116.83.98:8888 at ClientRequest. (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/node-fetch.js:1:306417) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:502:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] 10:28:05.511 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed. at v.dispose (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935) at ni.dispose (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299) at r.dispose (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/extension.node.js:138:4517) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async rT.listKernelsFromConnection (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/extension.node.js:235:22644) at async /nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/extension.node.js:235:20130] 10:28:05.511 [error] Failed to validate Password info [D [FetchError]: request to http://remote-server-ip:8888/tree? failed, reason: connect ECONNREFUSED 10.148.216.186:8888 at ClientRequest. (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/node-fetch.js:1:306417) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:502:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] { type: 'system', errno: 'ECONNREFUSED', code: 'ECONNREFUSED' } 10:28:05.517 [error] Error fetching kernels from http://remote-server-ip:8888/ (remote-server-ip): [FetchError: request to http://remote-server-ip:8888/api/kernels?1707157685513 failed, reason: connect ECONNREFUSED 10.148.216.186:8888 at ClientRequest. (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/node-fetch.js:1:306417) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:502:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] 10:28:05.520 [error] UniversalRemoteKernelFinder: Failed to get kernels without cache [FetchError: request to http://remote-server-ip:8888/api/kernels?1707157685513 failed, reason: connect ECONNREFUSED 10.148.216.186:8888 at ClientRequest. (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/node-fetch.js:1:306417) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:502:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] 10:28:05.520 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed. at v.dispose (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935) at ni.dispose (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299) at r.dispose (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/extension.node.js:138:4517) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async rT.listKernelsFromConnection (/nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/extension.node.js:235:22644) at async /nfs/site/disks/tadm_work_19/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/dist/extension.node.js:235:20130] 10:28:05.870 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd0cd805199a84c55772db822326d76150fb29da8490063933ca6c923deab3cb765./path/to/python/environment/.pixi/envs/default/python./path/to/python/environment/.pixi/envs/default/python.-m#ipykernel_launcher (Python Path: /path/to/python/environment/.pixi/envs/default/bin/python, Conda, 3.9.18) for 'path/to/jupyter/notebook/data_cleanup.ipynb' (disableUI=true) 10:28:07.134 [info] End refreshing Kernel Picker (1707157684576) 10:28:09.582 [error] Failed to get activated conda env vars for /path/to/python/environment/.pixi/env/bin/python in 4174ms 10:28:09.584 [error] Unable to determine site packages path for python /path/to/python/environment/.pixi/env/bin/python (Conda) 10:28:09.594 [info] Process Execution: /path/to/python/environment/.pixi/env/bin/python -m pip list 10:28:09.597 [error] Failed to get activated conda env vars for /path/to/python/environment/.pixi/envs/default/bin/python in 3714ms 10:28:09.599 [error] Unable to determine site packages path for python /path/to/python/environment/.pixi/envs/default/bin/python (Conda) 10:28:09.606 [info] Process Execution: /path/to/python/environment/.pixi/envs/default/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)" 10:28:09.613 [info] Process Execution: /path/to/python/environment/.pixi/envs/default/bin/python -m ipykernel_launcher --f=~/.local/share/jupyter/runtime/kernel-v2-31540CcI3YXsmyhtA.json > cwd: path/to/jupyter/notebook 10:28:09.619 [error] Failed to get activated conda env vars for /path/to/python/environment/.pixi/envs/default/bin/python in 3750ms 10:28:09.620 [error] Unable to determine site packages path for python /path/to/python/environment/.pixi/envs/default/bin/python (Conda) 10:28:09.626 [info] Process Execution: /path/to/python/environment/.pixi/envs/default/bin/python -m pip list 10:28:09.638 [info] Process Execution: /path/to/python/environment/.pixi/env/bin/python -c "import pip;print('6af208d0-cb9c-427f-b937-ff563e17efdf')" 10:28:09.671 [info] Process Execution: /path/to/python/environment/.pixi/envs/default/bin/python -c "import pip;print('6af208d0-cb9c-427f-b937-ff563e17efdf')" 10:28:10.757 [info] Process Execution: /path/to/python/environment/.pixi/envs/default/bin/python ~/.vscode-server/extensions/ms-toolsai.jupyter-2023.11.1003402403-linux-x64/pythonFiles/printJupyterDataDir.py 12:07:28.187 [info] Handle Execution of Cells 0 for path/to/jupyter/notebook/data_cleanup.ipynb 12:07:28.196 [info] Kernel acknowledged execution of cell 0 @ 1707163648195 12:07:29.495 [info] End cell 0 execution after 1.299s, completed @ 1707163649494, started @ 1707163648195 12:07:31.237 [info] Handle Execution of Cells 1 for path/to/jupyter/notebook/data_cleanup.ipynb 12:07:31.244 [info] Kernel acknowledged execution of cell 1 @ 1707163651244 12:07:31.246 [info] End cell 1 execution after 0.002s, completed @ 1707163651246, started @ 1707163651244 12:07:42.969 [info] Handle Execution of Cells 3 for path/to/jupyter/notebook/data_cleanup.ipynb 12:07:42.975 [info] Kernel acknowledged execution of cell 3 @ 1707163662975 12:07:43.606 [info] End cell 3 execution after 0.631s, completed @ 1707163663606, started @ 1707163662975 12:07:44.424 [info] Handle Execution of Cells 4 for path/to/jupyter/notebook/data_cleanup.ipynb 12:07:44.430 [info] Kernel acknowledged execution of cell 4 @ 1707163664430 12:07:44.432 [info] End cell 4 execution after 0.002s, completed @ 1707163664432, started @ 1707163664430 12:07:53.921 [info] Handle Execution of Cells 6 for path/to/jupyter/notebook/data_cleanup.ipynb 12:07:53.931 [info] Kernel acknowledged execution of cell 6 @ 1707163673931 12:08:21.689 [info] End cell 6 execution after 27.758s, completed @ 1707163701689, started @ 1707163673931 12:19:06.354 [info] Start refreshing Interpreter Kernel Picker 12:19:06.354 [info] Start refreshing Kernel Picker (1707164346354) 12:19:10.275 [info] End refreshing Kernel Picker (1707164346354) ```

DonJayamanne commented 9 months ago

Thanks for filing this issue and sorry you are running into this. Please can you let me know whats wrong with the latest versions, given the latest version is where we fix bugs I'd like you to try the latest version and let me know how that goes. (you will need to update your version of vscode as well).

amirhosseindavoody commented 9 months ago

This is the issue with the latest VScode version 1.86. It is incompatible with the version of linux we are running in our server. So, I had to revert back to 1.85.2.

Following up the VScode release the python extension also created another release that is incompatible with 1.85.2. So, I had to revert back that release as well.

As for the jupyter notebook extension, after checking I realized that the latest release is from 3 weeks ago, so I have updated the extension version to v2023.11.1100101639 but still getting the same error. I updated the bug discription to reflect the jupyter notebook extension version.

DonJayamanne commented 9 months ago

Now, none of the functionalities for jupyter notebook work.

Failed to get activated conda env vars for /path/to/python/environment/.pixi/envs/default/bin/python in 3714ms

This seems to be due to an error from python extension not being able to activate your conda environment

Unfortunate lly I'll have to transfer this issue too the python extension brepo as the underlying issue is in that extension

before i do that I'd like to clarify what isn't working exactly Are you trying to run code against you're local python env? If you're connecting to remote environments, you might want to try and remove the existing items and add them again

Based on the logs pylance isn't installed or might be disabled. Please can you check

amirhosseindavoody commented 9 months ago

You are right. The problem was with the python extension not recognizing the correct environment.

The root cause was this:

I don't think it is an issue with python or jupyter extensions. It is a bad setup on my part which I wasn't able to figure out.

The answers to your question:

DonJayamanne commented 9 months ago

@amirhosseindavoody , to be clear, this is a regression, i.e. it used to work, but not anymore, Thanks @karrtikr /cc