question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detection of Jupyter kernels fails for Python (Microsoft Store version)

See original GitHub issue

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

  1. Install Python 3.8 from the Microsoft Store
  2. Run pip install jupyter
  3. Try to run python code through vscode-python

Actual behavior

vscode-python fails to recognize existing kernels.

The point where things start to fall apart is jupyterKernelSpec.ts#parseKernelSpecs, where the response of jupyter kernelspec list gets parsed. Since Python is running sandboxed (UWP), the kernel specs are NOT located in %APPDATA%\... (as reported by jupyter kernelspec list), but in the redirected location %LOCALAPPDATA%\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\...

The call to fs.fileExists therefore returns false, resulting in a few messages like Kernel not created with the name python38264bitbb49e9738bee4bad94750749010b815e, display_name Python 3.8.2 64-bit. Output is Installed kernelspec python38264bitbb49e9738bee4bad94750749010b815e in C:\Users\stroy\AppData\Roaming\jupyter\kernels\python38264bitbb49e9738bee4bad94750749010b815e

Expected behavior

  • Jupyter selects the existing python kernel and runs the code

Workaround

  • Add an environment variable called JUPYTER_DATA_DIR, which points to the redirected AppData folder (à la C:\Users\<User>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\Roaming\jupyter).

Your Jupyter and/or Python environment

  • Jupyter server running: Local
  • Extension version: 2020.5.0-dev
  • VS Code version: 1.44.2
  • Setting python.jediEnabled: true
  • Python and/or Anaconda version: 3.8.2 (Microsoft Store version)
  • OS: Windows 10 1909
  • Virtual environment: N/A

Developer Tools Console Output

console.log

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
riverscncommented, Jun 22, 2020

I found a better way: Add environment variable JUPYTER_DATA_DIR=C:\Users\[username]\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_[random]\LocalCache\Roaming\jupyter and work like a charm.

2reactions
DavidKutucommented, Apr 27, 2020

Thanks for the feedback, we’ll add support for the Windows Store version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detection of Jupyter kernels fails for Python (Microsoft Store ...
This repros if the store python is the first to install jupyter. Installing jupyter with another python first will put the kernel specs...
Read more >
How to fix Kernel Error or broken Python in Jupyter Notebook
TL;DW BELOW! If you delete or upgrade your python version, you might get a Kernel Error when trying to use Jupyter Notebooks!
Read more >
jupyter server : not started, no kernel in vs code - Stack Overflow
Press Command+Shift+P on mac, Ctrl+Shift+p on windows · Type Jupyter: Select Interpreter to start Jupyterserver · It would show you a dropdown of ......
Read more >
How to Fix Kernel Error in Jupyter Notebook
So, a kernel error occurs when Jupyter fails to connect with a specific version of Python.
Read more >
Kernels for Jupyter Notebook on Spark clusters in Azure ...
A kernel is a program that runs and interprets your code. The three kernels are: PySpark - for applications written in Python2. (Applicable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found