VS Code using Jupyter: Connecting to kernel: Python 3.6.9: Waiting for Jupyter Session to be idle

Question:

I am having trouble running my import statement in VS code Jupyter. I split them into individual cells. I find when I run

import numpy as np

the cell hangs and I get a message

Connecting to kernel: Python 3.6.9: Waiting for Jupyter Session to be idle

How do I fix this?

Asked By: arame3333

||

Answers:

This may be related to the extended version. I hope this article is helpful to you.

Answered By: MingJie-MSFT

Alright so this one surprised me..

I was using Jupyter-like code cells "#%%" (see docs) to run jupyter notebook in VSCode. And I ran into the same issue as OP.

The error disappeared when I renamed my file, from "inspect.py" to "tmp.py".

Answered By: Tom O

I found my solution was to select the correct version of Python. I had 2 choices for Python 3.6.9. I chose the one called "base(Python 3.6.9)" which had a different location to "Python 3.6.9" and the base version worked. Something odd if going on here, maybe I should remove the other version?

Answered By: arame3333

For me, upgrading ipython to version 7.34.0 (from 7.32.0) fixed it. I’m using jedi version 0.18.1. Related

Update: this broke again for me when I upgraded my virtual environment to Python 3.8. I just upgraded my ipykernel package and now the notebook runs.

Answered By: chicxulub