vscode-jupyter: Unable to start session for kernel Python 3.8.5 32-bit

Bug: Notebook Editor, Interactive Window, Editor cells

Unable to start session for kernel Python 3.8.5 32-bit (‘venv’: venv). Select another kernel to launch with.

Steps to cause the bug to occur

There is really nothing special here

  1. Clone repo and start VSCode
  2. Run python -m venv venv
  3. Switch interpreter to venv and restart terminal
  4. Create main.ipynb
  5. Install data-science package when automatically prompted
  6. Unable to start-session.

Actual behavior

Unable to start session for kernel Python 3.8.5 32-bit (‘venv’: venv). Select another kernel to launch with.

Expected behavior

Notebook runs!

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: Local
  • Extension version: v2020.8.105369
  • VS Code version: 1.48.2
  • Setting python.jediEnabled: I don’t have this in my settings JSON file so default settings?
  • Setting python.languageServer: Microsoft
  • Python and/or Anaconda version: 3.8.5 32-bit
  • OS: Windows 10 Home 64-bit
  • Virtual environment: venv …

Python Output

The notebook can’t run so there is nothing to copy here. However, here is the installed package in the environment if it helps at all:

Package Version


argon2-cffi 20.1.0 attrs 20.1.0 backcall 0.2.0
bleach 3.1.5
cffi 1.14.2 colorama 0.4.3
decorator 4.4.2
defusedxml 0.6.0
entrypoints 0.3
flake8 3.8.3
ipykernel 5.3.4
ipython 7.18.1 ipython-genutils 0.2.0
ipywidgets 7.5.1
jedi 0.17.2 Jinja2 2.11.2 jsonschema 3.2.0 jupyter 1.0.0 jupyter-client 6.1.7 jupyter-console 6.2.0 jupyter-core 4.6.3 MarkupSafe 1.1.1 mccabe 0.6.1 mistune 0.8.4 nbconvert 5.6.1 nbformat 5.0.7 notebook 6.1.3 packaging 20.4 pandocfilters 1.4.2 parso 0.7.1 pickleshare 0.7.5 pip 20.1.1 prometheus-client 0.8.0 prompt-toolkit 3.0.7 pycodestyle 2.6.0 pycparser 2.20 pyflakes 2.2.0 Pygments 2.6.1 pyparsing 2.4.7 pyrsistent 0.16.0 python-dateutil 2.8.1 pywin32 228 pywinpty 0.5.7 pyzmq 19.0.2 qtconsole 4.7.6 QtPy 1.9.0 Send2Trash 1.5.0 setuptools 47.1.0 six 1.15.0 terminado 0.8.3 testpath 0.4.4 tornado 6.0.4 traitlets 5.0.0 wcwidth 0.2.5 webencodings 0.5.1 widgetsnbextension 3.5.1

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 31
  • Comments: 64 (7 by maintainers)

Most upvoted comments

Hey folks. In my local testing I believe that it was this update here to 5.0.0, which is picked up as part of our ipykernel install: https://pypi.org/project/traitlets/#history

In an activated environment that is not working try the following to drop it back to the older version: python -m pip install 'traitlets==4.3.3' --force-reinstall Make sure to have VS Code closed (as we sometimes are starting a kernel in the background, this will make sure that you pick up the install fresh the next time that you start).

Hey folks. In my local testing I believe that it was this update here to 5.0.0, which is picked up as part of our ipykernel install: https://pypi.org/project/traitlets/#history

In an activated environment that is not working try the following to drop it back to the older version: python -m pip install 'traitlets==4.3.3' --force-reinstall Make sure to have VS Code closed (as we sometimes are starting a kernel in the background, this will make sure that you pick up the install fresh the next time that you start).

Confirming that this resolves the issue. Thank you for looking into it.

Thank you very much! It is working now. Quotation marks are not necessary:

python3 -m pip install traitlets==4.3.3 --force-reinstall

or

pip3 install traitlets==4.3.3 --force-reinstall

On Tue, Sep 1, 2020 at 11:56 AM liteform notifications@github.com wrote:

Hey folks. In my local testing I believe that it was this update here to 5.0.0, which is picked up as part of our ipykernel install: https://pypi.org/project/traitlets/#history

In an activated environment that is not working try the following to drop it back to the older version: python -m pip install ‘traitlets==4.3.3’ --force-reinstall Make sure to have VS Code closed (as we sometimes are starting a kernel in the background, this will make sure that you pick up the install fresh the next time that you start).

Confirming that this resolves the issue. Thank you for looking into it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-python/issues/13701#issuecomment-684998235, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACM2HQQAJZTBZHEHLI243SLSDURSLANCNFSM4QQ4BE3Q .

Hey folks. In my local testing I believe that it was this update here to 5.0.0, which is picked up as part of our ipykernel install: https://pypi.org/project/traitlets/#history In an activated environment that is not working try the following to drop it back to the older version: python -m pip install ‘traitlets==4.3.3’ --force-reinstall Make sure to have VS Code closed (as we sometimes are starting a kernel in the background, this will make sure that you pick up the install fresh the next time that you start).

Confirmed on my end (Python3.8.5 64-bit; Windows).

OMG!!! You guys have just saved my life!!! I’ve been trying to solve this problem for HOURS!!!

I’m using Ubuntu 20.04. I’ve installed jupyter using “sudo pip3 install jupyter” in the terminal and jupyter notebook was working completely fine in the browser. However, when I tried to create a notebook in VSCode I got the message “Connecting to IPython kernel: Connecting to kernel”, and, after some minutes, the message “Unable to start session for kernel python 3.8”.

As suggested here, first I exited VSCode. Then I checked the version of “traitlets” installed, using the following command in ubuntu terminal:

$ pip3 freeze | grep traitlets

And it was installed some 5 version…

Then, I used the following command in ubuntu terminal:

$ sudo pip3 install “traitlets==4.3.3” --force-reinstall

Reopened VSCode and ran a notebook! Worked PERFECTLY!!!

Thank you very much you all, specially @IanMatthewHuff !!!

@Krendelev Unfortunately this workaround isn’t working for me.

The same problem, nothing works for me. I´ve tried upgrading traitlets to 5.04, I´ve tried traitlets 4.3.3. I´m working with Anaconda, I created a new enviroment, where I install Ipykernel conda install ipykernel ipython kernel install --name my_env --user Python 3.8.3 Windows 10 vscode 1.49.2

This should be fixed with latest traitlets 5.0.4, out earlier today. I haven’t been able to confirm directly, since I don’t know how to trigger the relevant code path myself, but manually executing a similar command-line is fixed with 5.0.4.

But is there anyone working on a more permanent fix that works with the latest version of traitlets and other things?

This extension shouldn’t need any updating, but the relevant change is that this b' prefix for configuring Bytes on the command-line is no longer required and support is deprecated (with no plans for removal). The bug was in traitlets 5,<5.0.4 not properly implementing the deprecated support for this prefix. It can be dropped if/when traitlets >=5.0 is required, but until then no changes are necessary. I wouldn’t rush, though, as pinning down is likely to be a common practice as bugs are worked out during a transition period.

Hey folks. In my local testing I believe that it was this update here to 5.0.0, which is picked up as part of our ipykernel install: https://pypi.org/project/traitlets/#history

In an activated environment that is not working try the following to drop it back to the older version: python -m pip install 'traitlets==4.3.3' --force-reinstall Make sure to have VS Code closed (as we sometimes are starting a kernel in the background, this will make sure that you pick up the install fresh the next time that you start).

Also works very well for me, thanks

If someone here is using pipenv to manage your packages, use the command below to install this package

pipenv install jupyter pipenv install traitlets==4.3.3

With both commands you can create the complete environment to work with jupyter notebook on vscode.

Hey folks. In my local testing I believe that it was this update here to 5.0.0, which is picked up as part of our ipykernel install:
https://pypi.org/project/traitlets/#history

In an activated environment that is not working try the following to drop it back to the older version:
python -m pip install 'traitlets==4.3.3' --force-reinstall
Make sure to have VS Code closed (as we sometimes are starting a kernel in the background, this will make sure that you pick up the install fresh the next time that you start).

Confirmed on my end (Python3.8.5 64-bit; Windows).

“python -m pip install traitlets==4.3.3 --force-reinstall --user” It works perfectly now! Thanks very much!!!

There is a workaround, you can use dependencies from an older workspace, if you have any. For example this set of requirements works in my case, but the updated ones not any more. I don’t know which version exactly causes the problem.

Actually just pip install notebook==6.0.3 works for me

Edit: complete requirements.txt that works, few packages downgraded. requirements.txt

Similar issue with Python 3.8.5 64-bit, not using venv output.txt

python -m pip install ‘traitlets==4.3.3’ --force-reinstall got an error message. try: pip uninstall traitlets pip install traitlets

works for me. thanks.

python -m pip install ‘traitlets==4.3.3’ --force-reinstall got an error message. try: pip uninstall traitlets pip install traitlets

works for me. thanks.

This worked for me as well!

I feel like I’m missing something? When I run python -m pip install 'traitlets==4.3.3' --force-reinstall and then open up VS Code and start up a new notebook, it tells me Data Science library ipykernel is not installed. Install? And if I select “Yes” it will update and then send me back to the Unable to start session for kernel Python 3.8.5 32-bit. Basically putting me in a loop.

Go to vscode (change the python interpreter to what you want), then run python -m pip install ipykernel and then do the degradation by python -m pip install 'traitlets==4.3.3' --force-reinstall

because when you are degrading it first then the installation of ipykernel updates it again nullfying your degradation

Hey folks. In my local testing I believe that it was this update here to 5.0.0, which is picked up as part of our ipykernel install: https://pypi.org/project/traitlets/#history

In an activated environment that is not working try the following to drop it back to the older version: python -m pip install 'traitlets==4.3.3' --force-reinstall Make sure to have VS Code closed (as we sometimes are starting a kernel in the background, this will make sure that you pick up the install fresh the next time that you start).

I just started today with VScode+jupyter (was already in with anaconda). This issue really tired me up and took my 4-5 hours to get to this post. FIrstly there was some compatibility issue with conda env kernel and then this stuff came up. but this solution saved my day. Thanks a lot

Hey folks. In my local testing I believe that it was this update here to 5.0.0, which is picked up as part of our ipykernel install: https://pypi.org/project/traitlets/#history

In an activated environment that is not working try the following to drop it back to the older version: python -m pip install 'traitlets==4.3.3' --force-reinstall Make sure to have VS Code closed (as we sometimes are starting a kernel in the background, this will make sure that you pick up the install fresh the next time that you start).

This really helped!