microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.31k stars 293 forks source link

Unable to start session for kernel Python 3.8.5 32-bit #728

Closed leonarduschen closed 4 years ago

leonarduschen commented 4 years ago

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

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

Brelliothe commented 4 years ago

Not work for me. Python 3.7.4 Windows 10 vscode 1.49.2

rocooper7 commented 4 years ago

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

IanMatthewHuff commented 4 years ago

@Brelliothe and @rocooper7 . There are different issues that can manifest as the same session start issues. At this point we have a number of confirmations that the traitlets issue is fixed. Can you please open up new issues for your reports? And please set the setting Python->Logging->Level to 'debug' then copy out the contents of the python output window into a file. You can then post that file attached to your issue and it will greatly help with debugging.

twospade commented 4 years ago

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.

ranaalisaeed commented 4 years ago

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!

chinatiger11 commented 4 years ago

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).

Thanks very much. It works perfect now

io614 commented 4 years ago

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

Works for me

JRDetwiler commented 4 years ago

I found that Code (OSS) tries to open the system Python by default, at least in version v2020.9.112786 of the extension. If you don't have ipykernel installed to the system Python, then it keeps trying to activate that environment, even if you try to select another.

For me, I installed python-ipykernel on Arch Linux and this fixed the issue. I can now use my Anaconda environment just fine.

yay -S python-ipykernel

It's a workaround for now, at least until the Python plugin stops doing this.

weirdyang commented 4 years ago

Doesn't work for me. Python 3.9.0 64-bit.

steps:

  1. uninstall ipykernel
  2. reinstall ipkernel
  3. do downgrade
  4. error; Timed out waiting to get a heartbeat from kernel process
GitProfAn commented 4 years ago

Doesn't work for me. Python 3.9.0 64-bit.

steps:

  1. uninstall ipykernel
  2. reinstall ipkernel
  3. do downgrade
  4. error; Timed out waiting to get a heartbeat from kernel process

Hello, have you tried (#14274)?

weirdyang commented 4 years ago

Solved the issue by recreating venv

Amundeep-Dhaliwal commented 3 years ago

Still experiencing the issue after running this downgrade of traitlets in windows terminal

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

I have periodically got the kernel to start, but no permanent long term fix. Deleting and setting a new pyenv did not help. In a new pyenv:

pip install ipython
pip install jupyter
pip install ipykernel --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org
python -m pip install 'traitlets==4.3.3' --force-reinstall 

I can run jupyter notebooks through a browser by running this command:

jupyter-notebook 

python 3.7.4 64 bit vscode version 1.52.1 wsl 2 ubuntu 20.04 LTS

neonbeast commented 3 years ago

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).

For windows it is showing this;

C:\Users\pc>python -m pip install 'traitlets==4.3.3' --force-reinstall ERROR: Invalid requirement: "'traitlets==4.3.3'" WHAT TO DO ? PLS HELP!! AND FOR ME I INSTALLED EVEN JUPITER USING pip install jupyter, I INSTALLED IPYTHON TOO AND IPYKERNEL TOO BUT IN VS CODE IT SHOWS ERROR , PLS HELP , I URGENTLY NEED IT DUE TO MY SCHOOL EXAMS!!

IanMatthewHuff commented 3 years ago

@neonbeast This specific issue should not be hit anymore as the problematic 5.0.0 version of traitlets has already been fixed. If you are installing a new pip install of jupyter you should get a working version of traitlets. I'd suspect that you are hitting a different issue with getting things running. Please open up a new issue in the repo here.

When you open up a new issue the following info is very helpful to us in debugging.

  1. Turn the VS Code setting Jupyter->Logging->Level to 'debug'
  2. Copy out the contents of the Output: Jupyter window when you see the error
  3. Save off the contents to a file and attach that file to the issue that you file.