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

Virtual Environment not listed #16409

Closed
AryaBuddha opened this issue Jun 6, 2021 · 4 comments
Closed

Virtual Environment not listed #16409

AryaBuddha opened this issue Jun 6, 2021 · 4 comments
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug

Comments

@AryaBuddha
Copy link

Environment data

  • VS Code version: 1.56.2
  • Extension version (available under the Extensions sidebar): v2021.5.842923320
  • OS and version: Windows 10 Pro build 19043.985 Version 21H1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.5 (Official website)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: None
  • Relevant/affected Python-related VS Code extensions and their versions: None
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

The Python Select Interpreter dialog is supposed to show both my globally installed Python interpreter and my virtual environment interpreter

When creating a new venv using python -m venv env, a system dialog that looks something like this is supposed to prompt me to select the newly created virtual environment as my main interpreter for that workspace.

image

Actual behaviour

The Python Select Interpreter dialog only shows 1 python interpreter (3.9.5) but does not show my venv.

No prompt shows up, and I have to manually activate my virtual environment through the terminal. Even choosing my venv through the Select Interpreter dialogue does not save the path, and I have to manually enter it every time.

Steps to reproduce:

  1. python -m venv env
    (No other steps needed, but the prompt as attached above is supposed to appear now)

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonJoinMailingListVar3'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'pythonSurveyNotification'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'DeprecatePythonPath - experiment'
Python interpreter path: C:\Python39\python.exe
Error 2021-06-06 15:54:48: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'c:\Users\aryad\Documents\Code\Clients\Tejas\qotd-bot\.vscode\settings.json' (Error: Unable to resolve non-existing file 'c:\Users\aryad\Documents\Code\Clients\Tejas\qotd-bot\.vscode\settings.json')
	at _handleError (c:\Users\aryad\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:156171)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async y.readText (c:\Users\aryad\.vscode\extensions\ms-python.python-2021.5.842923320\out\client\extension.js:9:344717)
	at async p.doesFileNeedToBeFixed (c:\Users\aryad\.vscode\extensions\ms-python.python-2021.5.842923320\out\client\extension.js:59:581560)
	at async c:\Users\aryad\.vscode\extensions\ms-python.python-2021.5.842923320\out\client\extension.js:59:580687
	at async Promise.all (index 1)
	at async p.getFilesToBeFixed (c:\Users\aryad\.vscode\extensions\ms-python.python-2021.5.842923320\out\client\extension.js:59:580633)
	at async p.updateTestSettings (c:\Users\aryad\.vscode\extensions\ms-python.python-2021.5.842923320\out\client\extension.js:59:580260)] {
  code: 'FileNotFound'
}
Starting Microsoft Python language server.
> conda --version

@AryaBuddha AryaBuddha added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jun 6, 2021
@karthiknadig karthiknadig added area-environments Features relating to handling interpreter environments triage and removed triage-needed Needs assignment to the proper sub-team labels Jun 7, 2021
@paulacamargo25
Copy link

Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can.

@abhishekbhakat
Copy link

Facing the same issue.
Is it still not reproducible ?

@paulacamargo25
Copy link

paulacamargo25 commented Jul 19, 2021

Sorry for the delay, can you please set the debug mode logging, you have to go to settings and change the python.logging.level to debug and send the logs when it fails to find.

@paulacamargo25
Copy link

Hi, we solved this issue, and we are also gradually rolling out an updated way of auto-selecting interpreters and sorting them in the "Select Interpreter" dropdown (#16520). You can opt into this experiment by adding the following to your settings.json:

"python.experiments.optInto": [
"pythonSortEnvs"
],

If you are in this experiment and you open a Python file, the virtual environment located in your workspace should be selected. Your virtual environment should also appear at the top of the list of environments as well, since we now sort workspace environments to appear higher.

Thanks

@paulacamargo25 paulacamargo25 removed their assignment Oct 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 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
Projects
None yet
Development

No branches or pull requests

4 participants