microsoft / vscode-jupyter

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

jupyter variables pane challenges #5101

Closed chrisdias closed 3 years ago

chrisdias commented 3 years ago

Environment data

Version: 1.55.0-insider (user setup) Commit: 5d80c30e5b6ce8b2f5336ed55ad043490b0b818f Date: 2021-03-08T05:13:14.184Z 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 2021.4.625511240 Python 2021.2.636928669 Python 3.8.5 Virtual Environment: None? Jupyter server running locally

Expected behaviour

I don't know how Jupyter Variables work, I expected that all variables defined in my cells, or at least the last cell run, would show up in the Jupyter Varaibles pane. However, sometimes the variables pane button doesn't appear and sometimes the contents of the pane don't appear until you click away (e.g. to the terminal) and back again.

Actual behaviour

No variables command/button on toolbar:

image

Jupyter Variables pane is empty after running:

image

Pane shows up after clicking on Terminal, then back to Jupyter Variables:

image

Steps to reproduce:

New Notebook, add some simple Python code:

image

If the Variables command/button shows up on the editor toolbar, click on it.

Result: no contents in variables pane

Click on Terminal, click on Variables pane

Result: see the variables

IanMatthewHuff commented 3 years ago

@chrisdias So for the two issues here:

  1. Looks (at least to my eyes) like a known issue just with the native notebook UI. We have a number of editor commands that we contribute both to the editor toolbar and the overflow menu. However these icons don't actually show up when a notebook document is first opened. The menu toolbar looks like this when first opened: image Our editor contributions don't actually get loaded until you click into a cell in the document. After that variable view and the rest of our contributed icons actually get loaded. I don't believe there is a way around this from our side currently. image

  2. The empty variables pane is more concerning. Is this a consistent repro for you? You mentioned it happening sometimes, but not specific steps. Before the file has executed or if there are no variables it should look like this: image

An empty panel would be indicative of the webview not loading at all.

chrisdias commented 3 years ago

ok, i see that i have to click on the cell to get the extension contributions into the toolbar area. what is weird is the first time I bring up the Notebook I get a run button, and when I click on the run button focus does not seem to be set to the cell, so the buttons are not added to the toolbar. Then, the run button is gone from the cell, I click on it, it gets focus.

in this video you can see the empty variables explorer. happens every time consistently. you can also see the missing run button in the video as well.

recording

IanMatthewHuff commented 3 years ago

Yeah, the Run Button visibility and our buttons not showing up until you actually click into a cell is all controlled on the vscode native notebook side. I agree with you that it's confusing though. Toolbar consistency is important, and having buttons that you expect to see appear or disappear is never a good thing. I'll loop with Don and Peng since I'm guessing that they have already discussed this before. Post that discussion I'll open up an issue to see if we can resolve this.

Apologies if I'm asking for too much on this, but the variable visibility thing does concern me, and right now your report (which I can clearly see in the video) is the only repro that I have on this. No one else on our team or external customers is seeing or reporting this yet. A couple of questions that might help to investigate this.

  1. I noticed that you are running on WSL. Do you see the same issue running just on your local machine? We've tested a bit on WSL, but it's a less common scenario.
  2. Do you see this same behavior on stable VS Code as well as insiders?
  3. When you first move over to the variables window and the window is totally empty does it not show even if you wait a while? The first time that the window is made visible it loads and creates the webview HTML for the first time. Usually this is pretty quick, but it does stay blank for a short while while loading. Just want to make sure that the issue here is that it is totally failing to load, and not that it's just slow for some reason.
  4. Final thing, there are a couple of logs that might shed more light on this. If you could pull the log from Help->Developer Tools->Console that would be one place. And if you set the setting Jupyter->Logging->Level to 'debug' the full log from the "Jupyter" section of the output would also be helpful. If you pull those right after you run code, then click the variables window and it stays blank and attach the logs to a comment here I can dig in if something seems off in them.

Appreciate the help, and sorry about all the questions.

chrisdias commented 3 years ago

DevTools Console:

console.ts:137 [Extension Host] (node:5766) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
log.ts:290  WARN Workbench did not finish loading in 10 seconds, that might be a problem that should be reported.
console.ts:137 [Extension Host]% 
Object
 (at Object.isFile (c:\Users\chris\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.163.2\dist\extension\extension.js:77:5155))
console.ts:137 [Extension Host]% 
Object
 (at Object.isFile (c:\Users\chris\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.163.2\dist\extension\extension.js:77:5155))
notificationsAlerts.ts:40 A notebook could execute harmful code when opened. Some outputs have been hidden. Do you trust this notebook? Learn more.
webviewElement.ts:102 [Embedded Page] 22:563 loaded markdown it
webviewElement.ts:102 [Embedded Page] IPyWidget kernel initializing...
console.ts:137 [Extension Host] Starting WebSocket: RAW/api/kernels/6c40912a-c2f0-4d93-87e7-f9b20e9afb20
console.ts:137 [Extension Host] Kernel: connected (6c40912a-c2f0-4d93-87e7-f9b20e9afb20)
webviewElement.ts:102 [Embedded Page] Starting WebSocket: BOGUS_PVSC/api/kernels/6c40912a-c2f0-4d93-87e7-f9b20e9afb20
webviewElement.ts:102 [Embedded Page] Kernel: connected (6c40912a-c2f0-4d93-87e7-f9b20e9afb20)
console.ts:137 [Extension Host] Starting WebSocket: RAW/api/kernels/0550a30b-81bd-4b4a-95f8-dea25f2672c9
console.ts:137 [Extension Host] Kernel: connected (0550a30b-81bd-4b4a-95f8-dea25f2672c9)

Jupyter Logs (I added "jupyter.logging.level": "debug" to my settings but i didn't see it as a setting in the UI or in completions, so not sure if I turned it on correctly)

User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'jupyterTestcf'
User belongs to experiment group 'pythonDiscoveryModule'
User belongs to experiment group 'NativeNotebookEditor'
> /usr/bin/python3 ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> /usr/bin/python3 ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Started kernel Python 3
> /usr/bin/python3 ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> /usr/bin/python3 ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.4.641214696/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v

 ​

IanMatthewHuff commented 3 years ago

I got one of our Windows team members to take a look. And yes, this seems to be a WSL only issue and they do repro it. Runs fine for them on local windows, but initially the variable view fails to show on WSL and you need to click off and then on it. Same as you were seeing. Thanks for filing, we'll have to investigate.

Team: De-assigning as I can't investigate on Mac.

DavidKutu commented 3 years ago

This seems to be fixed on:

Version: 1.56.0-insider (user setup) Commit: b4816cfd1f4161a3bb272354d181a9947760ee26

I'm moving to Validate. @rchiodo please validate when you get the chance.

joyceerhl commented 3 years ago

Validated, works fine with WSL now. Specifically:

wsl