Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Kernel picker wrongly displays Python 2.7.undefined for a valid Python 3.12 kernel #25146

Copy link
Copy link
Open
@avouacr

Description

@avouacr
Issue body actions

Applies To

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

What happened?

I run VSCode through the the latest code-server version in a containerized environment with Python 3.12.9 installed at /usr/local/bin/python. Yet at startup of the jupyter extension, the kernel picker does select the good Python environment but wrongly labels it Python 2.7.undefined for some reason.

Image

And when going into the kernel picker and browse through other python environments, the wrong label doesn't appear anymore, this time the (still correct) python kernel is correctly labelled.

Image

It is actually the only one showed, since I use the jupyter extension config to hide the other system installation of Python :

{
    "python.defaultInterpreterPath": "/usr/local/bin/python",
    "jupyter.kernels.excludePythonEnvironments": [
        "/usr/bin/python3",
        "/bin/python3"
    ]
}

I installed ipykernel to make a valid kernel from my python installation, and the kernel specs look just fine when I inspect them. Here is the content of /usr/local/share/jupyter/kernels/python3/kernel.json :

{
 "argv": [
  "python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3 (ipykernel)",
 "language": "python",
 "metadata": {
  "debugger": true
 }

So I'm a bit puzzled what what's happening there, and would gladly use some help :)

VS Code Version

1.99.3

Jupyter Extension Version

2025.3.0

Jupyter logs

Jupyter Extension Version: 2025.3.0.
Python Extension Version: 2025.4.0.
Pylance Extension not installed.
Platform: linux (x64).
Home = /home/onyxia
Temp Storage folder ~/.local/share/code-server/User/globalStorage/ms-toolsai.jupyter/version-2025.3.0
Workspace folder ~/work
20:50:15.820 [debug] Start refreshing Kernel Picker (1747083015819)
20:50:16.215 [trace] No controller, hence notebook communications cannot be initialized for editor Untitled-1.ipynb
20:50:16.215 [debug] Start refreshing Interpreter Kernel Picker
20:50:16.902 [debug] Python Env hidden via filter: /bin/python3
20:50:16.903 [debug] Python Env hidden via filter: /usr/bin/python3
20:50:16.910 [trace] Search for KernelSpecs in Interpreter /usr/local/bin/python
20:50:16.910 [trace] Search for KernelSpecs in Interpreter /bin/python3
20:50:16.910 [trace] Search for KernelSpecs in Interpreter /usr/bin/python3
20:50:16.910 [trace] Kernel Spec for 'Python 3 (ipykernel)' (/usr/local/share/jupyter/kernels/python3/kernel.json) is hidden. (isDefaultKernelSpec = true, language = python, registrationInfo = undefined)
20:50:16.914 [debug] Get Custom Env Variables, Class name = Rm, completed in 1095ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
20:50:16.914 [debug] Jupyter Paths /kernels: 
20:50:16.916 [debug] Kernel Spec Root Paths, /usr/share/jupyter/kernels, /usr/local/share/jupyter/kernels, ~/.local/share/jupyter/kernels
20:50:17.031 [trace] Conda file is conda
20:50:17.337 [debug] KernelProvider switched kernel to id = .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher
20:50:17.337 [debug] start the kernel, options.disableUI=true for Untitled-1.ipynb
20:50:17.411 [trace] Registering commtarget jupyter.widget
20:50:17.412 [debug] Controller selection change completed
20:50:17.427 [debug] Get Custom Env Variables, Class name = Rm, completed in 0ms, has a truthy return value, Arg 1: "~/work", Arg 2: "RunPythonCode"
20:50:17.428 [info] Starting Kernel (Python Path: /usr/local/bin/python, Unknown, 3.12.9) for 'Untitled-1.ipynb' (disableUI=true)
20:50:17.429 [trace] Creating raw notebook for resource 'Untitled-1.ipynb'
20:50:17.438 [debug] Get Custom Env Variables, Class name = Rm, completed in 0ms, has a truthy return value, Arg 1: "Untitled-1.ipynb", Arg 2: "RunPythonCode"
20:50:17.461 [debug] Launching kernel .jvsc74a57bd0949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1./usr/local/python./usr/local/python.-m#ipykernel_launcher for Untitled-1.ipynb in ~/work with ports 9001, 9000, 9004, 9002, 9003
20:50:17.513 [trace] Python API env change detected, update => '/usr/local/bin/python'
20:50:17.515 [debug] Python Env hidden via filter: /bin/python3
20:50:17.515 [trace] Python API env change detected, update => '/bin/python3'
20:50:17.516 [debug] Python Env hidden via filter: /usr/bin/python3
20:50:17.516 [trace] Python API env change detected, update => '/usr/bin/python3'
20:50:17.518 [debug] Refreshed Environments
20:50:17.619 [warn] Failed to get activated env vars for /usr/local/bin/python in 192ms
20:50:17.620 [debug] Create ProcessService, Class name = Tm (started execution), Arg 1: undefined
20:50:17.621 [debug] Get Custom Env Variables, Class name = Rm, completed in 1ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunNonPythonCode", Arg 3: undefined
20:50:17.621 [debug] Create ProcessService, Class name = Tm, completed in 1ms, has a truthy return value, Arg 1: undefined
20:50:17.627 [info] Process Execution: /usr/local/bin/python -c "import site;print("USER_BASE_VALUE");print(site.USER_BASE);print("USER_BASE_VALUE");"
20:50:17.628 [warn] Failed to get activated env vars for /usr/local/bin/python in 190ms
20:50:17.645 [trace] USER_SITE for /usr/local/bin/python is /home/~/.local/bin
20:50:17.645 [trace] Prepend PATH with user site path for /usr/local/bin/python, user site /home/~/.local/bin
20:50:17.645 [trace] Prepend PATH with python bin for /usr/local/bin/python
20:50:17.645 [trace] Prepend PATH with user site path for /usr/local/bin/python, user site /home/~/.local/bin
20:50:17.645 [trace] Prepend PATH with python bin for /usr/local/bin/python
20:50:17.645 [debug] Getting activated env variables, Class name = Pd, completed in 219ms, has a truthy return value, Arg 1: "~/work", Arg 2: "/usr/local/bin/python", Arg 3: undefined
20:50:17.645 [debug] Getting activated env variables, Class name = Pd, completed in 207ms, has a truthy return value, Arg 1: "Untitled-1.ipynb", Arg 2: "/usr/local/bin/python", Arg 3: undefined
20:50:17.651 [info] Process Execution: /usr/local/bin/python -m pip list
20:50:17.657 [info] Process Execution: /usr/local/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
20:50:17.660 [info] Process Execution: /usr/local/bin/python -m ipykernel_launcher --f=/home/~/.local/share/jupyter/runtime/kernel-v323a05f4586d38ecdd6adc8f16b943e7a3a401a12.json
    > cwd: ~/work
20:50:17.660 [debug] Kernel process 7440.
20:50:18.653 [debug] End refreshing Kernel Picker (1747083015819)
20:50:18.659 [debug] Kernel output 7440: To connect another client to this kernel, use:
--existing kernel-v323a05f4586d38ecdd6adc8f16b943e7a3a401a12.json
20:50:18.690 [debug] Waiting for Raw Session to be ready in postStartRawSession
20:50:18.690 [debug] Waiting for Raw session to be ready, status: connected
20:50:18.690 [trace] Raw session connected
20:50:18.691 [debug] Waited for Raw session to be ready & got status: connected
20:50:18.691 [debug] Successfully waited for Raw Session to be ready in postStartRawSession
20:50:18.691 [debug] Kernel status is 'unknown' before requesting kernel info and after ready
20:50:18.691 [debug] Sending request for kernelInfo
20:50:18.694 [trace] ipykernel version & path 6.29.5, /usr/local/lib/python3.12/site-packages/ipykernel/__init__.py for /usr/local/bin/python
20:50:18.715 [trace] Got response for requestKernelInfo
20:50:18.715 [debug] Successfully completed postStartRawSession after 1 attempt(s) in 24ms
20:50:18.717 [trace] Executing silently Code (idle) = import sys as _VSCODE_sys\nprint(_VSCODE_sys.executable); del _VSCODE_sys
20:50:18.731 [trace] Executing silently Code (completed) = import sys as _VSCODE_sys\nprint(_VSCODE_sys.executable); del _VSCODE_sys with 1 output(s)
20:50:18.732 [trace] Started running kernel initialization for Untitled-1.ipynb
20:50:18.732 [trace] Executing silently Code (idle) = try:\nimport ipywidgets as _VSCODE_ipywidgets\nprint("e976ee50-99ed-4aba-9b6b-9dcd5634d07d:IPy
20:50:18.747 [trace] Executing silently Code (completed) = try:\nimport ipywidgets as _VSCODE_ipywidgets\nprint("e976ee50-99ed-4aba-9b6b-9dcd5634d07d:IPy with 0 output(s)
20:50:18.748 [trace] Determined IPyWidgets Version as undefined
20:50:18.748 [trace] Executing silently Code (idle) = def __VSCODE_inject_module():\ndef __VSCODE_call_function(function, callback, data=None):
20:50:18.764 [trace] Executing silently Code (completed) = def __VSCODE_inject_module():\ndef __VSCODE_call_function(function, callback, data=None): with 0 output(s)
20:50:18.764 [debug] Requesting Kernel info
20:50:18.765 [trace] Got Kernel info
20:50:18.765 [trace] End running kernel initialization, now waiting for idle
20:50:18.765 [trace] Waiting for idle on (kernel): baf08b17-7cdb-4f0d-a980-439e5f5cb18d -> idle
20:50:18.765 [trace] Finished waiting for idle on (kernel): baf08b17-7cdb-4f0d-a980-439e5f5cb18d -> idle
20:50:18.765 [trace] End running kernel initialization, session is idle
20:50:18.766 [trace] Registering Kernel Completion Provider from kernel Python 3.12.9 for language python
20:50:18.767 [trace] IPyWidgetScriptSource.initialize
20:50:18.767 [info] Kernel successfully started
20:50:18.769 [debug] getDataDirsImpl, Class name = Lr (started execution), Arg 1: "Untitled-1.ipynb", Arg 2: "/usr/local/bin/python"
20:50:18.771 [debug] Get Custom Env Variables, Class name = Rm, completed in 0ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
20:50:18.771 [debug] Jupyter Paths : 
20:50:18.774 [debug] Get Custom Env Variables, Class name = Rm, completed in 3ms, has a truthy return value, Arg 1: "Untitled-1.ipynb", Arg 2: "RunPythonCode"
20:50:18.999 [warn] Failed to get activated env vars for /usr/local/bin/python in 228ms
20:50:18.999 [trace] Prepend PATH with user site path for /usr/local/bin/python, user site /home/~/.local/bin
20:50:18.999 [trace] Prepend PATH with python bin for /usr/local/bin/python
20:50:18.999 [debug] Getting activated env variables, Class name = Pd, completed in 228ms, has a truthy return value, Arg 1: "Untitled-1.ipynb", Arg 2: "/usr/local/bin/python", Arg 3: undefined
20:50:19.003 [info] Process Execution: /usr/local/bin/python /home/~/.local/share/code-server/extensions/ms-toolsai.jupyter-2025.3.0-universal/pythonFiles/printJupyterDataDir.py
20:50:19.022 [debug] getDataDirsImpl, Class name = Lr, completed in 253ms, has a truthy return value, Arg 1: "Untitled-1.ipynb", Arg 2: "/usr/local/bin/python", Return Value: <Uri:/home/~/.local/share/jupyter>, <Uri:/usr/local/share/jupyter>, <Uri:/usr/share/jupyter>

Coding Language and Runtime Version

Python v3.12.9

Language Extension Version (if applicable)

2025.4.0

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 bugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.