Skip to content

Run Selection/Line in Python Terminal fails unless ipykernel is installed #25922

@nnja

Description

@nnja

Type: Bug

Behaviour

On a fresh installation of VS Code with the Python extension, the feature "Run Selection/Line in Python Terminal" fails.

Steps to reproduce:

  1. Install fresh VS Code and Python extension
  2. Create a Python file, add a few lines
  3. Select some lines, right click, Run Python -> Run Selection/Line in Python Terminal
  4. Nothing happens, a popup shows up "Invalid arguments to create terminal"

Python version is 3.14.4

This is fixed by installing ipykernel in the environement. After installation, everything works as expected.

Oddly enough, the feature continues to work even after ipykernel is uninstalled from the selected environment.

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Extension version: 2026.4.0
VS Code version: Code 1.116.0 (Universal) (560a9dba96f961efea7b1612916f89e5d5d4d679, 2026-04-15T00:28:13Z)
OS version: Darwin arm64 25.4.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.14.4.final.0
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
debugpy ms- 2025.18.0
js-debug ms- 1.112.0
js-debug-companion ms- 1.1.3
jsts-chat-features Typ 0.0.2
python ms- 2026.4.0
vscode-js-profile-table ms- 1.0.10
vscode-pylance ms- 2026.2.1
vscode-python-envs ms- 1.28.0
System Info
Item Value
CPUs Apple M3 Pro (12 x 2400)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M3 Pro, Version 26.4 (Build 25E246))], DRIVER_VENDOR=Apple, DRIVER_VERSION=26.4 ACTIVE
Machine model name: Mac
Machine model version: 15.6
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 3, 4
Memory (System) 36.00GB (0.07GB free)
Process Argv
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsactivate1:31464700
cloudbuttont:31379625
42190218_ostrepl:31403339
bj468946:31457056
use-responses-api:31390855
ec5jj548:31422691
cp_cls_t_966_ss:31454198
c3h7c220:31478652
cp_cls_t_1081:31454832
conptydll_false:31489735
e9c30283:31461165
test_treatment2:31471001
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
534a6447:31496642
chat:31457767
cpptoolsoff-v2:31475362
ghj88844:31492074
ec1eg703:31491645
client_tst_t:31495907
ddid_t:31478206
getcmakediagnosticsoff:31489825
cp_cls_c_1082:31491634
logging_disabled_new:31493366
output_1x:31496637
748c7209:31497895

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-neededNeeds 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