microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.29k stars 291 forks source link

Can't see variables in Variable Explorer (React stack overflow #185) #9044

Closed lebr0nli closed 11 months ago

lebr0nli commented 2 years ago

Environment data

Expected behavior

Show variables.

Actual behavior

Show nothing.

Steps to reproduce:

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

  1. Use Remote -SSH extension to connect into a remote machine. (I used Google Colab.)
  2. Run some code to generate variables.
  3. You can see variables in "Variable Explorer" are "Loading". https://i.imgur.com/NnOtWDY.png
  4. After loading the variables, everything in "Variable Explorer" disappear. https://i.imgur.com/LAU0tZu.png

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.63.2, ssh-remote, desktop) Jupyter Extension Version: 2022.1.1001760686. Python Extension Version: 2022.0.1814523869. User belongs to experiment group 'jupyterTestcf' User belongs to experiment group 'jupyterEnhancedDataViewer' Info 03:44:25: ZMQ install verified. Info 03:44:26: Preferred kernel connection found in cache .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher Info 03:44:26: PreferredConnection: .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher found for NotebookDocument: /content/drive/MyDrive/colab_ssh/Term Project (Midterm)/test.ipynb Info 03:44:26: Early registration of controller for Kernel connection .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher Info 03:44:26: TargetController found ID: .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher for document /content/drive/MyDrive/colab_ssh/Term Project (Midterm)/test.ipynb Info 03:44:26: Setting controller affinity for /content/drive/MyDrive/colab_ssh/Term Project (Midterm)/test.ipynb .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher Info 03:44:27: Experiment status for python is {"enabled":true,"optInto":[],"optOutFrom":[]} Info 03:44:27: Setting setActiveController for /content/drive/MyDrive/colab_ssh/Term Project (Midterm)/test.ipynb Info 03:44:27: Getting activation commands for /usr/local/bin/python are not cached. May take a while. Info 03:44:27: KernelProvider switched kernel to id = .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher Info 03:44:27: Starting Notebook in kernel.ts id = .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher Info 03:44:27: Creating raw notebook for /content/drive/MyDrive/colab_ssh/Term Project (Midterm)/test.ipynb Info 03:44:27: Getting preferred kernel for /content/drive/MyDrive/colab_ssh/Term Project (Midterm)/test.ipynb Info 03:44:27: Computing working directory /content/drive/MyDrive/colab_ssh/Term Project (Midterm)/test.ipynb Info 03:44:27: Starting raw kernel Python 3.7.12 64-bit Info 03:44:27: installMissingDependencies /usr/local/bin/python Info 03:44:27: IPykernel found previously in this environment /usr/local/bin/python Info 03:44:27: Kernel launching with ports 9001,9002,9003,9004,9005. Start port is 9000 Info 03:44:27: No custom variables for Kernel as interpreter is not conda, but is Global Info 03:44:37: Getting activation commands for /usr/bin/python3 are not cached. May take a while. Info 03:44:37: Creating controller for jupyter-notebook with interpreter /usr/bin/python3 Info 03:44:37: Process Execution: > /usr/local/bin/python -m pip list > /usr/local/bin/python -m pip list Info 03:44:37: Process Execution: > /usr/local/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)" > /usr/local/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)" Info 03:44:37: Process Execution: > /usr/local/bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9004 --control=9002 --hb=9001 --Session.signature_scheme="hmac-sha256" --Session.key=b"fd272dde-0cc6-48a8-8fc2-591089b732b2" --shell=9003 --transport="tcp" --iopub=9005 --f=/tmp/tmp-11981y91CuNlXoXtD.json > /usr/local/bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9004 --control=9002 --hb=9001 --Session.signature_scheme="hmac-sha256" --Session.key=b"fd272dde-0cc6-48a8-8fc2-591089b732b2" --shell=9003 --transport="tcp" --iopub=9005 --f=/tmp/tmp-11981y91CuNlXoXtD.json Info 03:44:37: Process Execution: cwd: /content/drive/MyDrive/colab_ssh/Term Project (Midterm) cwd: /content/drive/MyDrive/colab_ssh/Term Project (Midterm) Info 03:44:37: Registering dummy command feature Info 03:44:38: Process Execution: > /usr/bin/python3 -m pip list > /usr/bin/python3 -m pip list Info 03:44:41: ipykernel version 4.10.1 for /usr/local/bin/python Info 03:44:41: ipykernel location /usr/local/lib/python3.7/dist-packages/ipykernel/__init__.py for /usr/local/bin/python Warn 03:44:42: StdErr from Kernel Process /usr/local/lib/python3.7/dist-packages/traitlets/traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5. FutureWarning) /usr/local/lib/python3.7/dist-packages/traitlets/traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use 'fd272dde-0cc6-48a8-8fc2-591089b732b2' instead of 'b"fd272dde-0cc6-48a8-8fc2-591089b732b2"'. FutureWarning) Info 03:44:44: Kernel Output: NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work. To exit, you will have to explicitly quit this process, by either sending "quit" from a client, or using Ctrl-\ in UNIX-like environments. To read more about this, see https://github.com/ipython/ipython/issues/2049 Info 03:44:44: Kernel Output: NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work. To exit, you will have to explicitly quit this process, by either sending "quit" from a client, or using Ctrl-\ in UNIX-like environments. To read more about this, see https://github.com/ipython/ipython/issues/2049 To connect another client to this kernel, use: --existing /tmp/tmp-11981y91CuNlXoXtD.json Warn 03:44:44: Didn't get response for requestKernelInfo after 19ms. Info 03:44:44: Raw session started and connected Started kernel Python 3.7.12 64-bit Info 03:44:44: Finished connecting e2e957a9-37f3-41a8-90fe-abdee3ce8495 Info 03:44:45: Executing silently Code (idle) = import sys\nprint(sys.executable) Info 03:44:45: Executing silently Code (completed) = import sys\nprint(sys.executable) Info 03:44:46: Process Execution: > /usr/local/bin/python -c "import sys;print(sys.executable)" > /usr/local/bin/python -c "import sys;print(sys.executable)" Info 03:44:47: UpdateWorkingDirectoryAndPath in Kernel Info 03:44:47: Executing silently Code (idle) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/content/drive/MyD Info 03:44:47: Executing silently Code (completed) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/content/drive/MyD Info 03:44:47: Waiting for idle on (kernel): 395f97dd-d91f-4c93-84c4-41db6a40b9e9 -> idle Info 03:44:47: Finished waiting for idle on (kernel): 395f97dd-d91f-4c93-84c4-41db6a40b9e9 -> idle Info 03:44:47: Registering dummy command feature Info 03:45:06: Loading webview. View is notset Info 03:45:06: Loading web view... Info 03:45:06: Webview panel created. Info 03:45:10: Web view react rendered Info 03:45:11: Executing silently Code (idle) = # Query Jupyter server for the info about a dataframe\nimport json as _VSCODE_json\nimport builtins as Info 03:45:11: Executing silently Code (idle) = # Query Jupyter server for the info about a dataframe\nimport json as _VSCODE_json\nimport builtins as Info 03:45:11: Executing silently Code (completed) = # Query Jupyter server for the info about a dataframe\nimport json as _VSCODE_json\nimport builtins as Info 03:45:11: Executing silently Code (idle) = import builtins\n_rwho_ls = %who_ls\nbuiltins.print(_VSCODE_getVariableTypes(_rwho_ls)) Info 03:45:11: Executing silently Code (completed) = # Query Jupyter server for the info about a dataframe\nimport json as _VSCODE_json\nimport builtins as Info 03:45:11: Executing silently Code (idle) = import builtins\n_rwho_ls = %who_ls\nbuiltins.print(_VSCODE_getVariableTypes(_rwho_ls)) Info 03:45:11: Executing silently Code (completed) = import builtins\n_rwho_ls = %who_ls\nbuiltins.print(_VSCODE_getVariableTypes(_rwho_ls)) Info 03:45:11: Executing silently Code (completed) = import builtins\n_rwho_ls = %who_ls\nbuiltins.print(_VSCODE_getVariableTypes(_rwho_ls)) Info 03:45:14: Execute Cells request 0 Info 03:45:14: Execute Cell 0 /content/drive/MyDrive/colab_ssh/Term Project (Midterm)/test.ipynb Info 03:45:17: Cell 0 executed with state Success Info 03:45:18: Executing silently Code (idle) = import builtins\n_rwho_ls = %who_ls\nbuiltins.print(_VSCODE_getVariableTypes(_rwho_ls)) Info 03:45:18: Executing silently Code (completed) = import builtins\n_rwho_ls = %who_ls\nbuiltins.print(_VSCODE_getVariableTypes(_rwho_ls)) Info 03:45:25: Searching for token colors ... Info 03:45:25: Attempting search for colors ... Warn 03:45:25: Color theme One Dark Pro Darker not found. Using default colors. Info 03:45:25: Attempting search for colors ... Warn 03:45:25: Color theme One Dark Pro Darker not found. Using default colors. ```

rchiodo commented 2 years ago

Thanks for the bug. I can't seem to repro. I get this:

image

Your extension version is a prerelease version from two weeks ago and your VS code version is one version behind.

You might try updating it to something more recent to see if the problem goes away.

Can you also include the output from the 'Help | Toggle Developer Tools', Console window. It looks to me like the variables window isn't even updating.

lebr0nli commented 2 years ago

Hi, I update my VSCode to 1.63.4 and my extension version to 2022.1.1301854968, but my Variable Explorer still has same issue.

Here are error messages in the console:

Invariant Violation: Minified React error #185; visit https://reactjs.org/docs/error-decoder.html?invariant=185 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
    at i (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:260)
    at l (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:530)
    at Yi (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:95127)
    at Object.enqueueSetState (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:44757)
    at t.E.setState (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:29:1670)
    at t.value (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:77:95446)
    at ca (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:45730)
    at wo (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:61650)
    at Bo (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:66586)
    at Oi (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:90411)
Uncaught Invariant Violation: Minified React error #185; visit https://reactjs.org/docs/error-decoder.html?invariant=185 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
    at i (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:260)
    at l (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:530)
    at Yi (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:95127)
    at Object.enqueueSetState (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:44757)
    at t.E.setState (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:29:1670)
    at t.value (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:77:95446)
    at ca (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:45730)
    at wo (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:61650)
    at Bo (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:66586)
    at Oi (https://vscode-remote+ssh-002dremote-002bcolab.vscode-resource.vscode-webview.net/root/.vscode-server/extensions/ms-toolsai.jupyter-2022.1.1301854968/out/datascience-ui/viewers/variableView.js:37:90411)
rchiodo commented 2 years ago

This should be the latest VS code:

Version: 1.64.2 (user setup)
Commit: f80445acd5a3dadef24aa209168452a3d97cc326
Date: 2022-02-09T22:02:28.252Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19044

Your error output does show something though. Sounds like a stack overflow exception in our react code.

Did you run any other code besides what the example showed before hitting this issue?

lebr0nli commented 2 years ago

Hi, I update my VSCode to 1.63.4 ....

Oops, sorry, I typed the wrong version...

My VS code version is:

Version: 1.64.2
Commit: f80445acd5a3dadef24aa209168452a3d97cc326
Date: 2022-02-09T22:00:58.347Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 19.4.0

Did you run any other code besides what the example showed before hitting this issue?

No, after installing the extension on my remote ssh device, I directly run my code.

shism2 commented 2 years ago

I have the same exact issue. Just as a side note looks like we are both performing a SSH tunnel from google colab to vscode. That is likely the factor causing some sort of unintended side effect.

rchiodo commented 2 years ago

Can you double check that the same version of the extension is on each machine? In this scenario the extension on the remote machine is sending data to the UI on the local machine. If they were not the same version, it might cause problems.

rchiodo commented 2 years ago

Actually no never mind, the remote host doesn't work that way. The webview HTML is actually sent across from the remote host, so it doesn't matter what the local extension version is.

rchiodo commented 2 years ago

Even with remote ssh I still don't repro. We'll need to add some logging in a private binary if we want to diagnose this.

shism2 commented 2 years ago

Maybe you can reproduce with this:

from google.colab import drive
drive.mount("/content/drive",force_remount=True)
%cd "XXXXXXXXXXX"
%pip install colab_ssh --upgrade
from colab_ssh import launch_ssh_cloudflared, init_git_cloudflared
launch_ssh_cloudflared()

init_git_cloudflared(repository_url="XXXXXXXXXX",
personal_token="XXXXXXXXXXX",
branch="main",
email="jcastilla358@gmail.com",
username="shism2")

An alternative to the cloudflared ssh setup:

from google.colab import drive
drive.mount("/content/drive",force_remount=True)
%cd "XXXXXXXXXXX"
%pip install colab_ssh --upgrade

ngrokToken = 'xxxxxxxxxxxx'
password = 'shism358'
from colab_ssh import launch_ssh, init_git
launch_ssh(ngrokToken,password)
amunger commented 1 year ago

@lebr0nli - can you confirm if this is still an issue? I don't think we've managed to get a repro on our side yet

lebr0nli commented 1 year ago

@lebr0nli - can you confirm if this is still an issue? I don't think we've managed to get a repro on our side yet

Seems like there still have the same issue, probably it's a special case that only happened on colab.

DonJayamanne commented 11 months ago

@lebr0nli Please can you check if this is still an issue with the latest version of VS COde and Jupyter extensxion?

amunger commented 11 months ago

the variable view will likely be replaced, so we'll just close this in favor of https://github.com/microsoft/vscode/issues/165445