vscode-python: GetInterpreterList does not pick up newly added virtual environments (when called from Jupyter)

Environment data

  • VS Code version: Insiders latest
  • Extension version 2021.10.1258668113-dev
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): XXX
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): XXX
  • Relevant/affected Python packages and their versions: XXX
  • Relevant/affected Python-related VS Code extensions and their versions: XXX
  • Value of the python.languageServer setting: XXX

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

Virtual environments just created will end up in list of kernels.

Actual behaviour

Virtual environments do not appear as kernels

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Create virtual env outside of vs code
  2. Open VS code in same root folder
  3. Open notebook
  4. New venv is not selectable as a kernel.
  5. Open python file
  6. New venv is selectable as a python interpreter.

This test run is failing for the same reason: https://github.com/microsoft/vscode-jupyter/runs/3669744903?check_suite_focus=true

Logs

Here’s the logs from jupyter. Notice how the venv ‘testDummyVenv’ is not listed. jupyterlog.txt

Here’s the logs from python. venv ‘testDummyVenv’ is listed. pythonlog.txt

We (Jupyter) are not getting the new venv when calling getInterpreterList. This seems like a recent regression.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments

@rchiodo If resource is passed as undefined, workspace envs are not reported as the VSCode API needs a URI: vscode.workspace.getWorkspaceFolder(uri), I think that’s what is happening.

In the extension we get the resource using https://github.com/microsoft/vscode-python/blob/c383e81e66a220f509dc38821700160e38784d55/src/client/interpreter/configuration/interpreterSelector/commands/base.ts#L33-L81