Search code examples
pythonpython-3.xvisual-studio-code

Python VS code does not connect with IPython kernel


I have created a new virtual env and trying to connect with the VS code. When I open the folder in VS code that contains the file and virtual env, on the left bottom side I can see the python interperator selected as shown in the following figure:

enter image description here

However, when I run the program, it shows the message that it is connecting to IPython Kernel as shown in the following picutre

enter image description here

However, after some time it throws an error message that "unable to start session for kernel python" as shown in the following picture:

enter image description here

The top right corner of VS code is shown in the following picture:

enter image description here

Could anyone help me in fixing the issue?


Solution

  • I had the same issue starting yesterday with two new virtual environments and different python versions (3.8.1 and 3.8.5). I can confirm that Simm Enley's suggested terminal command worked for me.

    python -m pip install 'traitlets==4.3.3' --force-reinstall

    It has to be executed from within the corresponding virtual environment. A newer version of traitlets (5.0.0) installed by VSCode into the new virtual environment in order to to run the Interactive Terminal caused the issue, it seems like.