Repository navigation
Cannot select 2.7 as interpreter #20637
Copy link
Copy link
Closed
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked onregressionBug didn't exist in a previous releaseBug didn't exist in a previous releaseverifiedVerification succeededVerification succeeded
Milestone
Description
Type: Bug
Behaviour
Expected vs. Actual
Expected: select Python 2.7.18 interpreter from drop-down list (via browsing)
Actual: nothing happens and yellow button "Select interpreter" is still displayed in the status bar. Latest vscode-python version which works fine is 2022.18.2. Any recent version have this bug. I didn't notice any warnings about dropping 2.7 completely in release notes, and hope it won't happen :)
Steps to reproduce:
Try to select Python 2.7.18 interpreter from drop-down list - browse to its folder and select python.exe
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 2.7.18
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
- Value of the
python.languageServersetting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Experiment 'pythonaacf' is active
LSP Notebooks experiment is enabled
LSP Notebooks interactive window support is enabled
> conda info --json
> c:\Python27\python.exe -I ~\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\interpreterInfo.py
> C:\Python3\python.exe -I ~\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\interpreterInfo.py
[ERROR 2023-1-3 4:14:12.83]: [Error: Command failed: c:\Python27\python.exe -I c:\Users\phantasm\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\get_output_via_markers.py c:\Users\phantasm\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\interpreterInfo.py
Unknown option: -I
usage: c:\Python27\python.exe [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
at ChildProcess.exithandler (node:child_process:408:12)
at ChildProcess.emit (node:events:526:28)
at maybeClose (node:internal/child_process:1092:16)
at Socket.<anonymous> (node:internal/child_process:451:11)
at Socket.emit (node:events:526:28)
at Pipe.<anonymous> (node:net:687:12)] {
killed: false,
code: 2,
signal: null,
cmd: 'c:\\Python27\\python.exe -I c:\\Users\\phantasm\\.vscode\\extensions\\ms-python.python-2023.2.0\\pythonFiles\\get_output_via_markers.py c:\\Users\\phantasm\\.vscode\\extensions\\ms-python.python-2023.2.0\\pythonFiles\\interpreterInfo.py'
}
> c:\Python27\python.exe -I ~\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\interpreterInfo.py
[ERROR 2023-1-3 4:14:14.136]: [Error: Command failed: c:\Python27\python.exe -I c:\Users\phantasm\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\get_output_via_markers.py c:\Users\phantasm\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\interpreterInfo.py
Unknown option: -I
usage: c:\Python27\python.exe [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
at ChildProcess.exithandler (node:child_process:408:12)
at ChildProcess.emit (node:events:526:28)
at maybeClose (node:internal/child_process:1092:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5)] {
killed: false,
code: 2,
signal: null,
cmd: 'c:\\Python27\\python.exe -I c:\\Users\\phantasm\\.vscode\\extensions\\ms-python.python-2023.2.0\\pythonFiles\\get_output_via_markers.py c:\\Users\\phantasm\\.vscode\\extensions\\ms-python.python-2023.2.0\\pythonFiles\\interpreterInfo.py'
}
Starting Pylance language server.
User Settings
languageServer: "Pylance"
Extension version: 2022.18.2
VS Code version: Code 1.75.0 (e2816fe719a4026ffa1ee0189dc89bdfdbafb164, 2023-02-01T15:23:45.584Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 7 5800X3D 8-Core Processor (16 x 3400) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off 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_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 15.92GB (4.49GB free) |
| Process Argv | --crash-reporter-id 4d41d7e4-4df1-46cd-80fe-eb31c1916345 |
| Screen Reader | no |
| VM | 67% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vscaac:30438847
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848:30577860
nodejswelcome1cf:30587006
3biah626:30602489
pyind779:30657576
89544117:30613380
pythonsymbol12cf:30657549
vscup:30628656
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked onregressionBug didn't exist in a previous releaseBug didn't exist in a previous releaseverifiedVerification succeededVerification succeeded
Activity
cesarcoatl commentedon Feb 3, 2023
Seeing the same behavior on macOS but not on Windows, running the latest versions of vscode and the Python extension.
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)phantasm commentedon Feb 3, 2023
commandline option -I is used to isolate Python from the user's environment (implies -E and -s), but it doesn't exist in python2, only in python3. It seems to me that it may be possible to replace -I option back to -E -s and see what happens
karthiknadig commentedon Feb 3, 2023
Python extension dropped support for python 2.7 a while ago. As underlying tools and libraries we depend on move forward, it is likely that this will stop working for unsupported versions.
If you need to work with python 2.7 you will have to pin to 2022.2.* version of the extension, which was the last version that had the debugger (debugpy) with support for python 2.7, and was tested with 2.7.
karrtikr commentedon Feb 4, 2023
FYI we have temporarily restored the ability to select Python 2.7 as an interpreter in pre-release, try it out:
However do note not all features are guaranteed to work properly so upgrade as soon as possible.
phantasm commentedon Feb 4, 2023
Kartik Raj (@karrtikr) seems to work now, but

Pylance doesn't want to use 2.7 as interpreter too. I've tried most of the old versions but no luck. Recent versions always use python3, older ones say "Python version 2.7 from interpreter is unsupported".
P.S. I'll be glad to move to python3, but now it's impossible - about 1M lines of code so I'm stuck with 2.7
karrtikr commentedon Feb 4, 2023
phantasm Try Jedi, set
python.languageServersetting to"Jedi". Unfortunately there aren't many workarounds for now other than rolling back and using older versions.phantasm commentedon Feb 4, 2023
Kartik Raj (@karrtikr) that's sad. jedi for 2.7 doesn't have intellisense so it's better to see some pylance errors than not having intellisense at all. sigh
thank you for your efforts anyway!
cesarcoatl commentedon Feb 4, 2023
I understand that the only option is to move forward, and I'm at peace with not getting all of the features. But since I am maintaining Jython applications Python 2.7 is my only option.
Thanks as well, Kartik Raj (@karrtikr).