Skip to content

XDG_DATA_HOME and JUPYTER_DATA_DIR are not being used when looking up kernels #16833

@jabbera

Description

@jabbera

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

We have a non-standard XDG_DATA_HOME. When resolving kernels none of the kernels residing in ${XDG_DATA_HOME}/jupyter/kernels are showing up in the picker.

This:

const linuxJupyterPath = path.join('.local', 'share', 'jupyter', 'kernels');

doesn't appear to be correct even though the documentation here says it is. The default should take into account the data files directory documented here where it explicitly says: "Jupyter uses a search path to find installable data files, such as kernelspecs and notebook extensions."

You can prove to yourself the first set of documentation is incorrect/incomplete easily:

uv venv d
source d/bin/activate
uv pip install ipykernel
JUPYTER_DATA_DIR=/tmp python -m ipykernel install --user --name "my_environment_name"

outputs:

Installed kernelspec my_environment_name in /tmp/kernels/my_environment_name

I believe the default should be set by calling this:

private getJupyterDataDir() {

To make this issue more confusing there seem to be 2 implementations of getting the kernelspec paths which can use 2 different cache locations one of which returns a single folder and another that returns multiple folders.

There is

public async getKernelSpecRootPaths(cancelToken: CancellationToken): Promise<Uri[]> {

and

public async getKernelSpecRootPath(): Promise<Uri | undefined> {

VS Code Version

(1.102.1, ssh-remote, desktop)

Jupyter Extension Version

2025.6.0

Jupyter logs

Visual Studio Code (1.102.1, ssh-remote, desktop)
Jupyter Extension Version: 2025.6.0.
Python Extension Version: 2025.10.1.
Python Environment Extension Version: 1.0.0.
Pylance Extension Version: 2025.6.2.
Platform: linux (x64).
Home = /home/mbarry
Temp Storage folder ~/.vscode-server/data/User/globalStorage/ms-toolsai.jupyter/version-2025.6.0
Workspace folder /mnt/persistent-server/profile/vscode-remote-server/extensions
17:25:20.062 [debug] Start refreshing Kernel Picker (1753377920062)
17:25:21.007 [debug] Get Custom Env Variables, Class name = Hm, completed in 945ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
17:25:21.007 [debug] Jupyter Paths /kernels: 
17:25:21.007 [debug] Kernel Spec Root Paths, /usr/share/jupyter/kernels, /usr/local/share/jupyter/kernels, ~/.local/share/jupyter/kernels
17:25:21.012 [debug] End refreshing Kernel Picker (1753377920062)
17:25:21.142 [trace] Python API env change detected, add => '/usr/bin/python3'
17:25:21.143 [trace] Search for KernelSpecs in Interpreter /usr/bin/python3
17:25:21.144 [debug] Start refreshing Kernel Picker (1753377921144)
17:25:21.152 [debug] End refreshing Kernel Picker (1753377921144)
17:25:21.153 [trace] Python API env change detected, add => '/usr/bin/python3.10'
17:25:21.153 [trace] Search for KernelSpecs in Interpreter /usr/bin/python3.10
17:25:21.153 [debug] Start refreshing Kernel Picker (1753377921153)
17:25:21.157 [debug] End refreshing Kernel Picker (1753377921153)
17:25:21.216 [trace] Python API env change detected, add => '/bin/python3'
17:25:21.217 [trace] Search for KernelSpecs in Interpreter /bin/python3
17:25:21.217 [debug] Start refreshing Kernel Picker (1753377921217)
17:25:21.225 [debug] End refreshing Kernel Picker (1753377921217)
17:25:21.226 [trace] Python API env change detected, add => '/usr/bin/python3.11'
17:25:21.227 [trace] Search for KernelSpecs in Interpreter /usr/bin/python3.11
17:25:21.227 [debug] Start refreshing Kernel Picker (1753377921227)
17:25:21.230 [debug] End refreshing Kernel Picker (1753377921227)
17:25:21.233 [trace] Python API env change detected, add => '/opt/conda/bin/python'
17:25:21.233 [trace] Search for KernelSpecs in Interpreter /opt/conda/bin/python
17:25:21.233 [debug] Start refreshing Kernel Picker (1753377921233)
17:25:21.240 [trace] Python API env change detected, add => '/bin/python3.10'
17:25:21.241 [trace] Search for KernelSpecs in Interpreter /bin/python3.10
17:25:21.244 [trace] Python API env change detected, add => '/opt/conda/envs/spyder-env/bin/python'
17:25:21.244 [trace] Search for KernelSpecs in Interpreter /opt/conda/envs/spyder-env/bin/python
17:25:21.260 [trace] Conda file is /opt/conda/bin/conda
17:25:21.273 [trace] Hiding default KernelSpec /opt/conda/bin/python for interpreter /opt/conda/bin/python (KernelSpec file /opt/conda/share/jupyter/kernels/python3/kernel.json)
17:25:21.276 [trace] Hiding default KernelSpec /opt/conda/envs/spyder-env/bin/python for interpreter /opt/conda/envs/spyder-env/bin/python (KernelSpec file /opt/conda/envs/spyder-env/share/jupyter/kernels/python3/kernel.json)
17:25:21.276 [debug] End refreshing Kernel Picker (1753377921233)
17:25:21.278 [trace] Python API env change detected, add => '/bin/python3.11'
17:25:21.278 [trace] Search for KernelSpecs in Interpreter /bin/python3.11
17:25:21.278 [debug] Start refreshing Kernel Picker (1753377921278)
17:25:21.281 [debug] End refreshing Kernel Picker (1753377921278)
17:25:21.282 [trace] Python API env change detected, add => '/usr/bin/python3.13'
17:25:21.282 [trace] Search for KernelSpecs in Interpreter /usr/bin/python3.13
17:25:21.283 [debug] Start refreshing Kernel Picker (1753377921283)
17:25:21.287 [debug] End refreshing Kernel Picker (1753377921283)
17:25:21.288 [trace] Python API env change detected, add => '/bin/python3.13'
17:25:21.289 [trace] Search for KernelSpecs in Interpreter /bin/python3.13
17:25:21.289 [debug] Start refreshing Kernel Picker (1753377921289)
17:25:21.292 [debug] End refreshing Kernel Picker (1753377921289)
17:25:21.978 [trace] Python API env change detected, update => '/opt/conda/bin/python'
17:25:21.978 [trace] Search for KernelSpecs in Interpreter /opt/conda/bin/python
17:25:21.978 [debug] Start refreshing Kernel Picker (1753377921978)
17:25:21.984 [trace] Hiding default KernelSpec /opt/conda/bin/python for interpreter /opt/conda/bin/python (KernelSpec file /opt/conda/share/jupyter/kernels/python3/kernel.json)
17:25:22.070 [debug] End refreshing Kernel Picker (1753377921978)

Coding Language and Runtime Version

No response

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Remote

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions