Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebook run action not visible on Windows but visible on Mac #6017

Closed
miguelsolorio opened this issue May 27, 2021 · 15 comments
Closed

Notebook run action not visible on Windows but visible on Mac #6017

miguelsolorio opened this issue May 27, 2021 · 15 comments
Assignees

Comments

@miguelsolorio
Copy link

Trying to figure if this is native notebook bug or a jupyter extension bug. I'm currently trying capture the end to end experience for opening a notebook file in VS Code.

image

  1. Open VS Code with an empty data & extensions directory
  2. Open a notebook file
  3. Install the recommended extension (Jupyter)
  4. Re-open file
  5. Trust notebook
  6. 🐛 Run a cell, run action is not visible

However on macOS, the run actions DOES show up, so there is some weird behavior here:

image

Python 2.7.15
Edition Windows 10 Pro
Version 20H2
Installed on ‎3/‎24/‎2021
OS build 19042.928
Experience Windows Feature Experience Pack 120.2212.551.0

Version: 1.57.0-insider (user setup)
Commit: 1082913dd012e21cc5f35a06f15c480ca447f67f
Date: 2021-05-27T06:55:24.593Z
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.19042

cc @claudiaregio

@rchiodo
Copy link
Contributor

rchiodo commented May 27, 2021

I believe this is caused by the jupyter extension not returning the kernels yet. They should appear if you wait.

@IanMatthewHuff
Copy link
Member

@misolori If you don't see the run button and kernel selections after a wait (look to see if during the wait the Python extension is trying to load that's the usual slowdown point) could you grab our logging info?

In vscode settings put Jupyter->Logging->Level to 'debug' and re-run the scenario. We then have a bunch of logging info in the Jupyter output window that we can look at to help debug.

@miguelsolorio
Copy link
Author

I've left the window open for several minutes and nothing changed, don't see any progress in the status bar or anywhere else. Here are the logs when I re-run the scenario:

Info 2021-05-27 09:21:58: Checking if notebook is trusted
Info 2021-05-27 09:21:58: Check if Notebook is Trusted, Class name = p, completed in 64ms, has a truthy return value, Return Value: true
Info 2021-05-27 09:21:58: notebook communications already initialized for editor file:///c%3A/Users/misolori/Documents/GitHub/notebooks/data-vizualization.ipynb
Info 2021-05-27 09:21:58: Attempting to start a server because of preload conditions ...
Info 2021-05-27 09:21:58: Find kernel spec, Class name = D, completed in 7ms, has a falsy return value, Arg 1: <Uri:c:\Users\misolori\Documents\GitHub\notebooks\data-vizualization.ipynb>, Arg 2: {"interpreter":{"hash":"0f3fc1f477b7b6e8a98505e87c3377c352684999b9cf604b9f6bec26ac37c02d"},"kernelspec":{"display_name":"Python 3.7.3 64-bit","language":"python","name":"python37364bit1b59b820878d42b59aebf362a9f522c1"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.8.2"},"metadata":{"interpreter":{"hash":"0f3fc1f477b7b6e8a98505e87c3377c352684999b9cf604b9f6bec26ac37c02d"}}}, Arg 3: {"_isCancelled":false,"_emitter":null}, Return Value: undefined
Error 2021-05-27 09:22:03: Failed to convert application/vnd.bokehjs_exec.v0+json output from a buffer object,  [SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at M (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:31338)
	at c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:32418
	at Array.reduceRight (<anonymous>)
	at R (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:32388)
	at Array.map (<anonymous>)
	at c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:27258
	at Object.t.createJupyterCellFromVSCNotebookCell (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:27307)
	at c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:229702
	at Array.map (<anonymous>)
	at l.getCellsWithId (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:229657)
	at y.getNotebookLines (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:52:461853)
	at y.checkNotebook (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:52:462803)
	at y.c.value (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:1:100537)
	at listOnTimeout (internal/timers.js:554:17)
	at processTimers (internal/timers.js:497:7)]
Error 2021-05-27 09:22:03: Failed to convert application/vnd.bokehjs_exec.v0+json output from a buffer object,  [SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at M (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:31338)
	at c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:32418
	at Array.reduceRight (<anonymous>)
	at R (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:32388)
	at Array.map (<anonymous>)
	at c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:27258
	at Object.t.createJupyterCellFromVSCNotebookCell (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:27307)
	at c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:229702
	at Array.map (<anonymous>)
	at l.getCellsWithId (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:16:229657)
	at h.checkNotebook (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:90:154393)
	at h.c.value (c:\Users\misolori\code-profiles\ext\ms-toolsai.jupyter-2021.6.881596855\out\client\extension.js:1:100537)
	at listOnTimeout (internal/timers.js:554:17)
	at processTimers (internal/timers.js:497:7)]

@miguelsolorio
Copy link
Author

miguelsolorio commented May 27, 2021

Also, if I try to run the cell via the keyboard shortcut I get the kernel picker but it is empty (also don't see any kernel references in the status bar or toolbar):

image

@miguelsolorio
Copy link
Author

Not sure if it was obvious by my repro steps + screenshots, but i specifically did not install the Python extension. This behavior differs from what I see on macOS.

@rchiodo
Copy link
Contributor

rchiodo commented May 27, 2021

The error you're showing sounds like this fix here:
eeeaa6c

What's your version of Jupyter Extension? Don should have fixed that with a release last night.

@IanMatthewHuff
Copy link
Member

Looks like Miguel is on 855 so that should be current. From the log it's "from a buffer" not "to a buffer" so it would actually be the function above the fix from Don.

Miguel could you share out the file?

@miguelsolorio
Copy link
Author

Yea I'm on v2021.6.881596855, here's a link to the file i'm using.

@DonJayamanne
Copy link
Contributor

@rchiodo @IanMatthewHuff the problem is the mime type application/vnd.bokehjs_load.v0+json didn't contain json data. Looks like we'll need to inspect the data to see of it's json or not instead of just looking for the word json in mine type.

Eg if typeof data === object and object.keys(data).length > 0 or similar before we convert to bytes. And we might want to add some metadata that also take is that it's a real json so that we can deserialize it in renderer

@DonJayamanne
Copy link
Contributor

Ie the bug is at our end in Jupyter extension

@IanMatthewHuff
Copy link
Member

IanMatthewHuff commented May 27, 2021

@DonJayamanne I agree. I'll look into it after the API renames. My only concern here is the following:

  • The code for this error should catch and just return back empty, it shouldn't be a full crash from what I see.
  • Miguel is seeing the run button issue on Windows and not on Mac. Mime type issue should be present on either OS.

So I believe there is the mime issue that we need to resolve, but I believe that it's possibly a red herring for the run button issue.

I'm on Mac so I'm not sure if I can verify myself. @misolori Apologies if we are asking too much here. But on windows with your repro steps do you also not see a run button if you open a notebook that is blank or has no output in it? Just tying to isolate if there is one issue here (mime issue) or two (mime issue + windows issue with loading controllers).

Edit: Regardless, it's an issue on our end, so I'll transfer this bug to vscode-jupyter. From the discussion at the team meeting Wednesday I believe that this was ok procedure. @jrieken (since this bug was assigned to you) if me moving this messes up vscode triage procedure, just tell me and I won't move any more issues.

@joyceerhl
Copy link
Contributor

joyceerhl commented May 28, 2021

I can reproduce the exact behavior that Miguel describes if I uninstall all Python interpreters, uninstall the Python extension, and delete all kernels from my jupyter/kernels directory.

@misolori You mentioned you have the default system Python 2.7, I assume that is on Mac? Do you have Python installed on your Windows machine at all?

If you don't have Python installed on your Windows machine (and no kernels), I think what might be happening here is that if you have no Python interpreters or kernels, the Jupyter extension does not register any notebook controller, and under the kernel push UX, the run button only appears when a kernel becomes available. If the Jupyter extension can't create and return any controllers, the run button stays hidden. On macOS Python 2.7 is available by default so perhaps we are able to setup a controller for that. We have plans to work around this by returning a dummy Python 3 kernel which would address this bug: #5861

@miguelsolorio
Copy link
Author

@misolori You mentioned you have the default system Python 2.7, I assume that is on Mac? Do you have Python installed on your Windows machine at all?

I misspoke, I had previously installed Python 2.7 so I did have that installed. I also tried the repro steps on a Windows Sandbox environment and still saw the same issue. However, in today's insiders I am no longer seeing this issue so not sure if the Jupyter extension pushed an update that fixed this. Here are my current versions:

Jupyter: v2021.6.885080120
Version: 1.57.0-insider (user setup)
Commit: 541a5d4fa70ab3095f23b28b88914e1f6a8f65c4
Date: 2021-05-28T09:50:57.063Z
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.19041

@miguelsolorio
Copy link
Author

Closing as I can no longer repro and it appears to be fixed. Appreciate everyone's help here!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@IanMatthewHuff @jrieken @DonJayamanne @rchiodo @joyceerhl @miguelsolorio and others