-
Notifications
You must be signed in to change notification settings - Fork 1.2k
It is not detecting my interpreter automatically #16664
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
Comments
Duplicate of #16613 |
@karthiknadig This is the prompt everyone is talking about: |
This prompt, again, comes form python extension only when it is activated (I have pasted links to actual code in the extension that does the detections and shows you that literal prompt) . You are seeing this prompt because the python extension was activated when you created the virtual env so it was able to detect it automatically. VS Code does not know about python environments, the python extension for VS Code does. Here is where we detect that the environment was created: vscode-python/src/client/pythonEnvironments/legacyIOC.ts Lines 173 to 187 in 5033f1d
We create the prompt here: vscode-python/src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts Lines 82 to 112 in 5033f1d
You can literally see the text of the prompt here: vscode-python/src/client/common/utils/localize.ts Lines 271 to 274 in 5033f1d
I understand that for you this was some how working before. The point we are trying to tell you is that for this to work the extension had to be activated. So previously the extension was getting activated for you some how. We need to figure out why that was the case, and why it stopped activating. To understand what might be broken or failing here, we need to know if it works at all when activated. If it works when activated, then the next step is to figure out why extension is not activating in cases where it was previously activating for you. If we understand these two things we can get you where you were before this issue began. You can try reverting to an older version of the extension to see if it works for you. |
I'm a user and not interested in the technical part. The prompt was working for many, not just me. It is not working now even when the extension is activated by opening a python file. And I wonder, if it is a fresh install of VSCode and python extension, and it is the user's first project, how it is possible to activate the extension because there is no python file available to user before creating the virtual environment? |
Perhaps the extension used to monitor the file system and detect the presence of python.exe ? |
@karthiknadig |
@omidshojaee a virtual environment is not required to create a Python file as the virtual environment should be a subdirectory of your workspace (if they are creating a virtual environment locally). And a lot of users don't even create a virtual environment for their first project. Lastly, we try to detect local virtual environments in the workspace at start-up of the extension. We also automatically activate if certain files are present in your workspace (e.g. |
And please understand we locked the other issue due to the tone that was being taken with us and the team. I'm happy to answer your question here as long as it stays respectful like it has so far on this issue. |
Environment data
python.languageServer
setting: Default[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
I'm working with Python extension for a year now. I always received a prompt about "detecting the Python interpreter" right after creating the virtual environment. Now that prompt is not showing up anymore so I have to set the interpreter manually.
Actual behaviour
No prompt is showing up about Python interpreter after creating the virtual environment
python -m venv venv
.Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)The text was updated successfully, but these errors were encountered: