Skip to content

Allow to enter Poetry keyring password to detect poetry envs in a repository where credentials are required #18204

@axxelG

Description

@axxelG

VS Code version

1.63.2

Extension version

v2021.12.1559732655

OS type

Windows

OS version

10

Python distribution

Other

Python version

3.7.3

Language server

Pylance

Expected behaviour

With a custom repository that requires authentication, I like to see my poetry virtualenvs and discovering python interpreters should finish successfully after a short time.
I guess the best solution is to prompt for the keyring password. This will fix issues with other poetry commands that require authentication, too.

FYI: There is an open issue @Poetry why they are opening the keyring for such commands: python-poetry/poetry#4874

Actual behaviour

There are no poetry virtual envs detected and discovering python interpreters runs forever.

Steps to reproduce

Configure a repo that requires authentication in your pyproject.toml

[[tool.poetry.source]]
name = "innogames"
url  = "https://<host>/artifactory/api/pypi/<repo>/simple"
default = true

Start VS Code

Logs

I'm pretty sure the crucial part is poetry env list --full-path. This is what happens if I run that command in a shell:

<username>@<mypc>:~/repos/invoiceprocessor$ poetry env list --full-path
Please enter password for encrypted keyring:

This is what happens within VS Code:

Experiment 'pythonaacf' is active
Experiment 'pythonTensorboardExperiment' is active
Experiment 'PythonPyTorchProfiler' is active
Experiment 'pythonDeprecatePythonPath' is active
[DEBUG 2021-11-17 10:52:9.166]: Cached data exists KeyPrefix=Cache_Method_Output_p.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/home/<username>/repos/invoiceprocessor"-Arg-Separator-undefined
[DEBUG 2021-11-17 10:52:9.173]: Cached data exists KeyPrefix=Cache_Method_Output_p.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/home/<username>/repos/invoiceprocessor"-Arg-Separator-undefined
[DEBUG 2021-11-17 10:52:9.174]: Cached data exists KeyPrefix=Cache_Method_Output_p.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/home/<username>/repos/invoiceprocessor"-Arg-Separator-undefined
[DEBUG 2021-11-17 10:52:9.196]: Testing: Setting up watcher for /home/<username>/repos/invoiceprocessor
[INFO 2021-11-17 10:52:9.202]: [
  'Display locator refreshing progress, Class name = h, completed in 0ms, has a falsy return value, , Return Value: undefined'
]
[DEBUG 2021-11-17 10:52:9.204]: Searching for conda.
[DEBUG 2021-11-17 10:52:9.207]: Probing conda binary: conda
[DEBUG 2021-11-17 10:52:9.215]: Getting poetry for cwd /home/<username>/repos/invoiceprocessor
[DEBUG 2021-11-17 10:52:9.216]: Probing poetry binary for /home/<username>/repos/invoiceprocessor: poetry
[DEBUG 2021-11-17 10:52:9.235]: Cached data exists KeyPrefix=Cache_Method_Output_p.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/home/<username>/repos/invoiceprocessor"-Arg-Separator-undefined
[DEBUG 2021-11-17 10:52:9.236]: Cached data exists KeyPrefix=Cache_Method_Output_p.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/home/<username>/repos/invoiceprocessor"-Arg-Separator-undefined
[INFO 2021-11-17 10:52:9.286]: > conda info --json
> conda info --json
[DEBUG 2021-11-17 10:52:9.287]: [Error: spawn conda ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn conda',
  path: 'conda',
  spawnargs: [ 'info', '--json' ]
}
[DEBUG 2021-11-17 10:52:9.289]: Searching for workspace virtual envs in: /home/<username>/repos/invoiceprocessor
[INFO 2021-11-17 10:52:9.289]: > "poetry env list --full-path"
> "poetry env list --full-path"
[INFO 2021-11-17 10:52:9.289]: cwd: ~/repos/invoiceprocessor
cwd: ~/repos/invoiceprocessor
[DEBUG 2021-11-17 10:52:9.399]: Cached data exists getEnvironmentVariables, <No Resource>
[INFO 2021-11-17 10:52:9.399]: > /usr/bin/python3 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> /usr/bin/python3 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
[DEBUG 2021-11-17 10:52:9.444]: Couldn't locate the conda binary.
[INFO 2021-11-17 10:52:9.449]: Found interpreter for /usr/bin/python3,/home/<username>/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
Python interpreter path: /usr/bin/python3
[INFO 2021-11-17 10:52:9.462]: Found: /usr/bin/python3 --> /usr/bin/python3.7
[INFO 2021-11-17 10:52:9.463]: Found: /usr/bin/python3.7 --> /usr/bin/python3.7
[INFO 2021-11-17 10:52:9.467]: Found: /usr/include/python3.7 --> /usr/include/python3.7m
[DEBUG 2021-11-17 10:52:9.539]: Getting roots
[DEBUG 2021-11-17 10:52:9.539]: Found roots
[DEBUG 2021-11-17 10:52:9.542]: Start watching root /home/<username>/repos/invoiceprocessor for globs ["python","*/python","*/bin/python"]
[DEBUG 2021-11-17 10:52:9.542]: Start watching: /home/<username>/repos/invoiceprocessor with pattern python using VSCode API
[DEBUG 2021-11-17 10:52:9.542]: Start watching: /home/<username>/repos/invoiceprocessor with pattern */python using VSCode API
[DEBUG 2021-11-17 10:52:9.543]: Start watching: /home/<username>/repos/invoiceprocessor with pattern */bin/python using VSCode API
[DEBUG 2021-11-17 10:52:9.679]: Cached data exists getEnvironmentVariables, <No Resource>
[INFO 2021-11-17 10:52:9.680]: > /usr/include/python3.7 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> /usr/include/python3.7 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
[DEBUG 2021-11-17 10:52:9.685]: [Error: Command failed: "/usr/include/python3.7" "/home/<username>/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py"
/bin/sh: 1: /usr/include/python3.7: Permission denied

	at ChildProcess.exithandler (child_process.js:308:12)
	at ChildProcess.emit (events.js:315:20)
	at maybeClose (internal/child_process.js:1048:16)
	at Socket.<anonymous> (internal/child_process.js:439:11)
	at Socket.emit (events.js:315:20)
	at Pipe.<anonymous> (net.js:673:12)] {
  killed: false,
  code: 126,
  signal: null,
  cmd: '"/usr/include/python3.7" "/home/<username>/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py"'
}
[DEBUG 2021-11-17 10:57:26.666]: Cached data exists KeyPrefix=Cache_Method_Output_p.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/home/<username>/repos/invoiceprocessor"-Arg-Separator-undefined
[DEBUG 2021-11-17 10:57:26.666]: Cached data exists KeyPrefix=Cache_Method_Output_p.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/home/<username>/repos/invoiceprocessor"-Arg-Separator-undefined
[DEBUG 2021-11-17 10:57:26.667]: Cached data exists getEnvironmentVariables, extension-output-ms-python.python-#1

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-environmentsFeatures relating to handling interpreter environmentsfeature-requestRequest for new features or functionalityneeds community feedbackAwaiting community feedback

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions