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

Python interpreter is not getting selected #12165

Closed
shrey27tri01 opened this issue Jun 5, 2020 · 6 comments
Closed

Python interpreter is not getting selected #12165

shrey27tri01 opened this issue Jun 5, 2020 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@shrey27tri01
Copy link

Environment data

  • VS Code version: 1.45.1
  • OS and version: Windows 10 Home version 1909
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): true
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

Normal running of Python programs in VSCode, i.e, compilation and running without any interferences.

Actual behaviour

I have been having this problem for many weeks now. Whenever I open a python file in VSCode, an alert comes, saying : "Python is not installed. Please download and install Python before using the extension". So I tried uninstalling and then reinstalling python on my Windows system. But the problem still persists. Also, whenever I open a python file in VSCode, the status bar shows "Select Python Interpreter", and even after I select a particular interpreter, it still shows the alert.

This is now becoming irritating, since everytime I open a python file, this problem occurs, although the code compiles and runs perfectly.

@shrey27tri01 shrey27tri01 added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jun 5, 2020
@karrtikr
Copy link

karrtikr commented Jun 6, 2020

Please upload the Python output channel as mentioned in the issue template. Also can you please try the following user setting and see if you still see this issue,

"python.experiments.optOutFrom": ["DeprecatePythonPath - experiment"]

@shrey27tri01
Copy link
Author

@karrtikr, I am not exactly sure what do you mean by 'upload the Python output channel'. Can you please elaborate a bit more, please?
Also, I tried the user setting you recommended, but still having the same problem.

@karrtikr
Copy link

karrtikr commented Jun 7, 2020

The issue template is displayed to you when you open a new issue https://github.com/microsoft/vscode-python/blob/master/.github/ISSUE_TEMPLATE/2_bug_report.md
You can follow the instructions here to get the Python output channel.

@shrey27tri01
Copy link
Author

shrey27tri01 commented Jun 8, 2020

@karrtikr, the python output channel is:

User belongs to experiment group 'AlwaysDisplayTestExplorer - experiment'
User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'WebHostNotebook - control'
User belongs to experiment group 'LocalZMQKernel - control'
User belongs to experiment group 'NativeNotebook - control'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'RunByLine - control'
> conda --version
> pyenv root
> conda info --json
> python3.7 c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3.7 c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3.6 c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3 c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -2 c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\me\AppData\Local\Programs\Python\Python38-32\python.exe c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Python interpreter path: ~\AppData\Local\Programs\Python\Python38-32\python.exe
Starting Microsoft Python language server.
> conda env list
> ~\AppData\Local\Programs\Python\Python38-32\python.exe c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import jupyter"
> ~\AppData\Local\Programs\Python\Python38-32\python.exe c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import jupyter"
> ~\AppData\Local\Programs\Python\Python38-32\python.exe c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import notebook"
> ~\AppData\Local\Programs\Python\Python38-32\python.exe c:\Users\me\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\pyvsc-run-isolated.py -c "import notebook"
Diagnostic Code: InvalidEnvironmentPathVariableDiagnostic, Message: The environment variable 'Path' seems to have some paths containing the '"' character. The existence of such a character is known to have caused the Python extension to not load. If the extension fails to load please modify your paths to remove this '"' character.
> conda --version

@shrey27tri01
Copy link
Author

Okay, so I found what the problem was. According to my python output channel,

The environment variable 'Path' seems to have some paths containing the '"' character. The existence of such a character is known to have caused the Python extension to not load. If the extension fails to load please modify your paths to remove this '"' character.

I modified and corrected my 'Path' to remove some stray semicolons, then after reopening VSCode, the python extension loaded perfectly.
Thanks to @karrtikr for the help.

@karthiknadig karthiknadig self-assigned this Jun 8, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jun 8, 2020
@karthiknadig
Copy link
Member

The extensions should not fail to load if there is an issue with the PATH env variable. This should be handled when we address discovery via path when doing #12020

@ghost ghost removed the triage label Jun 8, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants