You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GetInterpreterList does not pick up newly added virtual environments (when called from Jupyter) #17492
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]
Rich Chiodo (@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.
Looks like the first call to getInterpreters can be out of date.
Wasn't that always the case though? When a new workspace is opened, first call to getInterpreters always relied on the existing cache first, which won't have the latest environments unless discovery is finished.
I can reproduce this issue with the stable version of the extension as well, although when trying with the stable version, the kernel list eventually gets updated to contain the new environments, which doesn't make sense as Jupyter supposedly caches the getInterpreters() API call results 👀
Activity
rchiodo commentedon Sep 22, 2021
Related: microsoft/vscode-jupyter#5319
rchiodo commentedon Sep 22, 2021
I'm going to look at this. It's blocking development in the jupyter extension.
karrtikr commentedon Sep 22, 2021
Rich Chiodo (@rchiodo) If
resourceis passed asundefined, 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
vscode-python/src/client/interpreter/configuration/interpreterSelector/commands/base.ts
Lines 33 to 81 in c383e81
karrtikr commentedon Sep 22, 2021
We should probably use this logic if no resource is set instead of calling vscode api to get workspace folder directly
4 remaining items
rchiodo commentedon Sep 22, 2021
Looks like the first call to getInterpreters can be out of date.
karrtikr commentedon Sep 22, 2021
Wasn't that always the case though? When a new workspace is opened, first call to getInterpreters always relied on the existing cache first, which won't have the latest environments unless discovery is finished.
I can reproduce this issue with the stable version of the extension as well, although when trying with the stable version, the kernel list eventually gets updated to contain the new environments, which doesn't make sense as Jupyter supposedly caches the
getInterpreters()API call results 👀rchiodo commentedon Sep 22, 2021
Maybe the timing is different then. With stable our tests pass. With insiders our tests fail. Let me try on my machine
rchiodo commentedon Sep 22, 2021
Using this version it doesn't repro for me.
Version: 2021.8.1159798656
Using this version it also doesn't repro for me:
Version: 2021.9.1246542782
rchiodo commentedon Sep 22, 2021
But with insiders it does.
rchiodo commentedon Sep 22, 2021
What version of the jupyter extension do you have? The jupyter cache is a recent thing that Don added.
rchiodo commentedon Sep 22, 2021
Actually does it really matter? It's broken either way. Until the event is in the API it makes sense for it to force a refresh.
karrtikr commentedon Sep 22, 2021
I am able to reproduce it with stable as well. The first query doesn't contain the envs if we click fast enough.

If we click the second time, it's in the list.I was using
v2021.8.2041215044Jupyter always.karrtikr commentedon Sep 22, 2021
Yeah, it just seems like it was never supposed to work.
rchiodo commentedon Sep 24, 2021
Tests seem to be reproing this. I believe there's still a problem with untitled files. At least during our tests running.