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

VS Code Insiders does not automatically detect system python interpreter on Windows 10 with WSL 2 #15458

Closed
brybalicious opened this issue Feb 19, 2021 · 4 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@brybalicious
Copy link

brybalicious commented Feb 19, 2021

Environment data

  • VS Code Version: 1.54.0-insider (user setup)
    Commit: 192c817fd350bcbf3caecae22a45ec39bae78516
    Date: 2021-02-19T05:14:28.632Z
    Electron: 11.2.3
    Chrome: 87.0.4280.141
    Node.js: 12.18.3
    V8: 8.7.220.31-electron.0
  • Extension version: Python v2021.2.576481509
  • OS and version: Windows 10 x64 10.0.19042
  • Python version: System version -> Python 3.8.5
  • Type of virtual environment used: pyenv + pipenv on WSL 2 with Ubuntu 20.04 LTS
  • Relevant/affected Python packages and their versions: -
  • Relevant/affected Python-related VS Code extensions and their versions: -
  • Value of the python.languageServer setting: -

Expected behaviour

When selecting Python Interpreter, at least 3 ought to be automatically found - Python 3.7.9 64-bit ('3.7.9: pyenv'), Python 3.9.0 64-bit ('3.9.0: pyenv') and Python 3.8.5 64-bit system version located at /usr/bin/python on WSL 2

Actual behaviour

Only the two pyenv interpreters are found, and 3.8.5 system version cannot be found. It can, however, be added manually by specifying /usr/bin/python. It also appears when running pyenv versions or python --version from bash in WSL2

Steps to reproduce:

  1. Open Visual Studio Code Insiders in any directory with a python file, with no virtualenv initialised.

code-insiders .

Possibly related to Issue #15439 but I am having the opposite problem on Windows 10 with WSL 2, using visual studio code insiders.

Logs

User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonJoinMailingListVar3'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonInstallPylintButtonFirstcf'
User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - experiment'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'DeprecatePythonPath - control'
User belongs to experiment group 'RunByLine - experiment'
User belongs to experiment group 'CustomEditorSupport - control'
Error 2021-02-19 20:14:12: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat 'python3.8'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'python3.8'
}
Error 2021-02-19 20:14:12: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat 'python2.7'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'python2.7'
}
Error 2021-02-19 20:14:12: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat 'python3.8'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'python3.8'
}
Error 2021-02-19 20:14:12: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat 'python3.8'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'python3.8'
}
Error 2021-02-19 20:14:12: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat 'python2.7'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'python2.7'
}
Error 2021-02-19 20:14:12: Failed to resolve symbolic link: [Error: ENOENT: no such file or directory, lstat 'python3.8'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'python3.8'
}
Error 2021-02-19 20:14:12: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://wsl+ubuntu/home/username/.config/Code - Insiders/User/settings.json' (Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu/home/username/.config/Code - Insiders/User/settings.json')
at _handleError (/home/username/.vscode-server-insiders/bin/192c817fd350bcbf3caecae22a45ec39bae78516/out/vs/server/remoteExtensionHostProcess.js:85:150406)
at async y.readText (/home/username/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/out/client/extension.js:9:298266)
at async p.doesFileNeedToBeFixed (/home/username/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/out/client/extension.js:59:481374)
at async /home/username/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/out/client/extension.js:59:480501
at async Promise.all (index 0)
at async p.getFilesToBeFixed (/home/username/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/out/client/extension.js:59:480447)
at async p.updateTestSettings (/home/username/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/out/client/extension.js:59:480074)] {
code: 'FileNotFound'
}

python3.7 ~/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python3.6 ~/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python3 ~/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python2 ~/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python ~/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
~/.pyenv/versions/3.7.9/bin/python ~/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Starting Jedi Python language engine.
conda --version
conda info --json
conda --version
Python interpreter path: ~/.pyenv/versions/3.7.9/bin/python
Error 2021-02-19 20:14:13: Detection of Python Interpreter for Command python3.7 and args failed as file does not exist
~/.pyenv/versions/3.7.9/bin/python ~/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /mnt/c/Users/username/Git/multi-user/docs/conf.py
cwd: /mnt/c/Users/username/Git/multi-user
~/.pyenv/versions/3.7.9/bin/python ~/.vscode-server-insiders/extensions/ms-python.python-2021.2.576481509/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /mnt/c/Users/username/Git/multi-user/docs/conf.py
cwd: /mnt/c/Users/username/Git/multi-user
##########Linting Output - pylint##########
************* Module conf
93,4,error,import-error:Unable to import 'sphinx_material'


</p>
</details>
@brybalicious brybalicious added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Feb 19, 2021
@brybalicious
Copy link
Author

I finally managed to set up pyenv so that pyenv shims come first in the path, and added a symlink

sudo ln -s //usr/bin/python3 //usr/bin/python

which fixed the problem of system python not appearing when running pyenv versions.

Now, however, in visual studio code insiders, the system python doesn't show up as an available interpreter (which I would imagine should be found automatically in usr/bin/python. I can add it manually though, but it doesn't persist beyond one session and still doesn't show up as an option in the drop-down.

@brybalicious
Copy link
Author

brybalicious commented Feb 19, 2021

Also just initialised a Pipfile in a repo with Pipenv, using python 3.9.0. Then deleted it, altered the Pipfile to require 3.7.7, then reinitialised it. Then, ran pipenv shell and from the virtualenv, launched code-insiders .

Code Insiders launched with 3.9.0 associated with the virtualenv... which is wrong. This didn't use to be a problem

EDIT: it just took a moment to update. Virtualenv works fine and the interpreter is correctly found. The original issue still persists, however.

@karthiknadig
Copy link
Member

@brybalicious We released a fix for the environment issue. Can you install the latest version and verify?

@karthiknadig karthiknadig added area-environments Features relating to handling interpreter environments info-needed Issue requires more information from poster triage labels Feb 22, 2021
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Feb 22, 2021
@brettcannon
Copy link
Member

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants