question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GetInterpreterList does not pick up newly added virtual environments (when called from Jupyter)

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
karrtikrcommented, Sep 22, 2021

@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

0reactions
rchiodocommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

New Virtual environments not listed in Kernels until i reload ...
GetInterpreterList does not pick up newly added virtual environments (when called from Jupyter) microsoft/vscode-python#17492.
Read more >
Jupyter Notebook doesn't show new environments
To use jupyter notebook inside a virtual environment, ipykernal is required to be installed in your venv. Inside your virtual environment:.
Read more >
Creating and Using Virtual Environment on Jupyter Notebook ...
A virtual environment, just as the name implies, is an environment that is virtually created. It is an empty place isolated from our...
Read more >
Jupyter Notebook is unable to find module in virtual environment
Jupyter Notebook is unable to find module in virtual environment. import statement shows module not found error. If you follow allow different article...
Read more >
Use Virtual Environments Inside Jupyter Notebooks & Jupter ...
However, they're easy to add to your Jupyter Notebook or Jupyter Lab setup. This post will describe just how you can use them....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found