Skip to content

Cannot select 2.7 as interpreter #20637

Closed

Description

@phantasm

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.languageServer setting: 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

Activity

  1. cesarcoatl commented on Feb 3, 2023

    @cesarcoatl

    Seeing the same behavior on macOS but not on Windows, running the latest versions of vscode and the Python extension.

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

    Experiment 'pythonSurveyNotification' is active
    LSP Notebooks experiment is disabled -- Jupyter disabled or not installed
    LSP Notebooks interactive window support is disabled -- not in LSP Notebooks experiment
    > ~/.pyenv/versions/2.7.18/envs/ignition-api/bin/python -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-2 17:34:34.36]: Error: Command failed: /Users/thecesrom/.pyenv/versions/2.7.18/envs/ignition-api/bin/python -I /Users/thecesrom/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py /Users/thecesrom/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
    Unknown option: -I
    usage: /Users/thecesrom/.pyenv/versions/2.7.18/envs/ignition-api/bin/python [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: '/Users/thecesrom/.pyenv/versions/2.7.18/envs/ignition-api/bin/python -I /Users/thecesrom/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py /Users/thecesrom/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py'
    }
    > ~/.pyenv/versions/2.7.18/envs/ignition-api/bin/python -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-2 17:34:36.48]: Error: Command failed: /Users/thecesrom/.pyenv/versions/2.7.18/envs/ignition-api/bin/python -I /Users/thecesrom/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py /Users/thecesrom/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py
    Unknown option: -I
    usage: /Users/thecesrom/.pyenv/versions/2.7.18/envs/ignition-api/bin/python [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: '/Users/thecesrom/.pyenv/versions/2.7.18/envs/ignition-api/bin/python -I /Users/thecesrom/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/get_output_via_markers.py /Users/thecesrom/.vscode/extensions/ms-python.python-2023.2.0/pythonFiles/interpreterInfo.py'
    }
    Starting Pylance language server.
    
    

  2. phantasm commented on Feb 3, 2023

    @phantasm
    Author

    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

  3. karthiknadig commented on Feb 3, 2023

    @karthiknadig
    Member

    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.

  4. karrtikr commented on Feb 4, 2023

    @karrtikr

    FYI we have temporarily restored the ability to select Python 2.7 as an interpreter in pre-release, try it out:

    image

    However do note not all features are guaranteed to work properly so upgrade as soon as possible.

  5. phantasm commented on Feb 4, 2023

    @phantasm
    Author

    Kartik Raj (@karrtikr) seems to work now, but
    image

    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

  6. added
    bugIssue identified by VS Code Team member as probable bug
    regressionBug didn't exist in a previous release
    area-environmentsFeatures relating to handling interpreter environments
    verifiedVerification succeeded
    needs PRReady to be worked on
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Feb 4, 2023
  7. karrtikr commented on Feb 4, 2023

    @karrtikr

    phantasm Try Jedi, set python.languageServer setting to "Jedi". Unfortunately there aren't many workarounds for now other than rolling back and using older versions.

  8. phantasm commented on Feb 4, 2023

    @phantasm
    Author

    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!

  9. cesarcoatl commented on Feb 4, 2023

    @cesarcoatl

    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).

  10. locked as resolved and limited conversation to collaborators on Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onregressionBug didn't exist in a previous releaseverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions