Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python2 cannot be set as a valid interpreter #20722

Closed
leonixyz opened this issue Feb 21, 2023 · 2 comments
Closed

python2 cannot be set as a valid interpreter #20722

leonixyz opened this issue Feb 21, 2023 · 2 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@leonixyz
Copy link

leonixyz commented Feb 21, 2023

Using VSCode Web

code-server: v4.10.0
Code: 1.75.1
Commit: 441438abd1ac652551dbe4d408dfcec8a499b8bf
Date: 2023-02-13T16:47:00.619Z
Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36

and v2023.2.0 of this extension

Whenever I try to change to a python2 interpreter, I get an error popup, and the following in printed in the Output > Python console

Experiment 'pythonaa' is active
LSP Notebooks experiment is disabled -- not using Pylance
LSP Notebooks interactive window support is disabled -- not in LSP Notebooks experiment
> conda info --json
> /opt/pyenv/versions/2.7.16/bin/python -I ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py
[ERROR 2023-1-21 16:55:31.308]: [Error: Command failed: /opt/pyenv/versions/2.7.16/bin/python -I /config/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py /config/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py
Unknown option: -I
usage: /opt/pyenv/versions/2.7.16/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

	at ChildProcess.exithandler (node:child_process:402:12)
	at ChildProcess.emit (node:events:513:28)
	at maybeClose (node:internal/child_process:1100:16)
	at Socket.<anonymous> (node:internal/child_process:458:11)
	at Socket.emit (node:events:513:28)
	at Pipe.<anonymous> (node:net:301:12)] {
  code: 2,
  killed: false,
  signal: null,
  cmd: '/opt/pyenv/versions/2.7.16/bin/python -I /config/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py /config/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py'
}
> /opt/pyenv/versions/3.7.16/bin/python -I ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py
> /bin/python3 -I ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py
> /usr/bin/python3 -I ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py
> /opt/pyenv/versions/2.7.16/bin/python -I ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py ~/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py
[ERROR 2023-1-21 16:55:33.316]: [Error: Command failed: /opt/pyenv/versions/2.7.16/bin/python -I /config/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py /config/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py
Unknown option: -I
usage: /opt/pyenv/versions/2.7.16/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

	at ChildProcess.exithandler (node:child_process:402:12)
	at ChildProcess.emit (node:events:513:28)
	at maybeClose (node:internal/child_process:1100:16)
	at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)] {
  code: 2,
  killed: false,
  signal: null,
  cmd: '/opt/pyenv/versions/2.7.16/bin/python -I /config/extensions/ms-python.python-2023.2.0-universal/pythonFiles/get_output_via_markers.py /config/extensions/ms-python.python-2023.2.0-universal/pythonFiles/interpreterInfo.py'
}
[ERROR 2023-1-21 16:55:33.580]: Unable to start Jedi language server as a valid interpreter is not selected
[ERROR 2023-1-21 16:56:21.488]: Unable to start Jedi language server as a valid interpreter is not selected

It seems that on line 46 of src/client/pythonEnvironments/base/info/environmentInfoService.ts python -I is called, but -I is only supported on python3.

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 21, 2023
@karrtikr
Copy link

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
Copy link

Closing as dup of #20637. Please check that for workarounds.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants