vscode: Unable to run cells in Jupyter Notebooks

  • VS Code Version: Insider
  • OS Version: Mac

Steps to Reproduce:

  1. Install Jupyter extension
  2. Open a notebook, select Kernel A
  3. Run a cell & confirm execution order changes to 1
  4. Next Select kernel B
  5. Run a cell & confirm execution order changes to 1
  6. Close this notebook
  7. Reload VS Code.
  8. Open the same notebook.
  9. Confirm Kernel B is selected on the bottom
  10. Run a cell, it looks like (progress UI displayed) the cell ran.
  11. But there are errors in the error log indicating that it could not.
Screen Shot 2021-05-12 at 09 49 45

@jrieken @roblourens /cc

FYI - this is very easy to replicate and we’re running into this consistently. Our tests don’t catch this as we invoke the command executeCommand('notebook.selectKernel' to get around an issue where VS Code prompts selection or kernels (that blocks all of our tests, hence this work around)

Does this issue occur when all extensions are disabled?: N/A

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

When kernels are registered, since the event is emitted but the listener is not bound yet, so the broadcasting of kernel binding is not sent to extension host. It doesn’t happen with GH NB or Jupyter without Python is kernel registration happens first, and then the notebook document is created, and then the event listener is already registered.

I am certain it’s the something to do with kernel selection and preferred, because if you manually change the kennel it works, or if you close the document and open it again (sometimes that doesn’t work you must change the kernel)