VSCode Jupyter not connecting to python kernel

Question:

Launching a cell will make this message appear: Connecting to kernel: Python 3.9.6 64-bit: Activating Python Environment 'Python 3.9.6 64-bit'. This message will then stay up loading indefinitely, without anything happening. No actual error message.

I’ve already tried searching for this problem, but every other post seem to obtain at least an error message, which isn’t the case here. I still looked at some of these, which seemed to indicate the problem might have come from the traitlets package. I tried to downgrade it to what was recommended, but it didn’t solve anything, so I reverted the downgrade.

The main problem here is that I have no idea what could cause such a problem, without even an error message. If you think additional info could help, please do ask, I have no idea what could be of use right now.

Asked By: GregoirePelegrin

||

Answers:

Not sure what did the trick but downgrading VSCode to November version and after that reinstalling Jupyter extension worked for me.

Answered By: Napuu

I am using mac.os. I moved vscode from the download folder to the application folder. This solved my problem.

Answered By: MinxinLu

If anyone has the same problem, before reinstalling VSCode as the accepted answer said, try closing and reopening VSCode first.

That worked for me, saving me the agony of having to reinstall VSCode.

On the VSCode download page, there are two Windows installer types: ‘User Installer’ and ‘System Installer’.

I had VSCode installed in AppData folder, using user installer. On the OP’s problem occurrence, I tried to restart, reinstall and downgrade VSCode, as other answers suggested, but nothing helped.
Finally, I tried with System Installer. It requires elevated privileges during installation and installs VSCode in Program Files folder. That solved the problem for me.
So, one may try with different installation type.

Answered By: Oliver

i’ve just found out it’s solved by simply just right clicking on code.exe, set to ‘run as administrator’, and done.

Answered By: Hati

None of the previous answers are working for me (windows 10 + python 3.10.9 + VSCode x64-1.74.3). What made things work was downgrading VS Code. I arbitrarily chose VSCode x64-1.66.2

Answered By: Erre Hache

just turn off restricted mode in the left bottom corner of vscode

Answered By: Omar AbuRok

I believe the previous answers would work fine, this is just my personal solution.
I am using a school computer, so I can’t upgrade/downgrade VS code, or ‘run as administrator’. Following directions from GPT4, I did Ctrl+Shift+P, found ‘reload window’ (by directly typing into the search bar), and that solved my problem.

Answered By: Drummer Tomato

in VSCode Ctrl+Shift+P typing ‘reload window’ worked for me!

Answered By: user24638321