Python interpreter not detected
See original GitHub issueEnvironment data
- VS Code version: 1.38.1
- Extension version (available under the Extensions sidebar): 2019.9.34911
- OS and version: Windows_NT x64 10.0 18362
- Python version (& distribution if applicable, e.g. Anaconda): Anaconda3 3.7.4
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): Pipenv
- Relevant/affected Python packages and their versions: Python itself.
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"
set to; more info #3977): N/A
Expected behaviour
Select Python Interpreter should show the current interpreter. which is already assigned in .vscode/settings.json like below.
{ "python.pythonPath": "C:\\Users\\Jaepil\\.virtualenvs\\likelion-WdsTZA1R\\Scripts\\python.exe" }
Actual behaviour
Select Python Interpreter warning is shown and the extension keeps telling me to select a python interpreter. Some of the virtualenvs are shown in the list but some are not. I don’t know what’s the difference.
Please see this screenshot: https://imgur.com/a/wflBshp
Why are some of the interpreters are shown while some of them are not?
Steps to reproduce:
I have absolutely no idea how this happened. All that I did was opening a new VSCode window while the other was still open. However, I did this several times before and it was all fine then.
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
User belongs to experiment group 'ShowPlayIcon - control'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
Starting Jedi Python language engine.
> conda --version
> pyenv root
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> py -3.7 -c "import sys;print(sys.executable)"
> py -3.6 -c "import sys;print(sys.executable)"
> py -3 -c "import sys;print(sys.executable)"
> py -2 -c "import sys;print(sys.executable)"
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe -c "import sys;print(sys.executable)"
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> ~\Anaconda3\Scripts\conda.exe info --json
> ~\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python3.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python3.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> ~\Anaconda3\Scripts\conda.exe env list
> ~\.virtualenvs\20190117_informatics_contest-taotUAHV\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\20190117_informatics_contest-taotUAHV\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\KIS_Research-1sAPdYt-\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\KIS_Research-1sAPdYt-\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\PyTorchZeroToAll-hoWX9lIa\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\PyTorchZeroToAll-hoWX9lIa\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\System32-eU24dAeB\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\System32-eU24dAeB\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\WebScrapingWithPython_Notebook-Wh9dVbnF\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\WebScrapingWithPython_Notebook-Wh9dVbnF\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> ~\.virtualenvs\python-scraping-n26INho8\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\python-scraping-n26INho8\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\pytorch_tutorials-8nbdP8vq\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\pytorch_tutorials-8nbdP8vq\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\testproject-P1Q1RQ0U\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\testproject-P1Q1RQ0U\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\vid_scraper-gdpErQhb\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\vid_scraper-gdpErQhb\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\web1-Jti_MdSz\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\web1-Jti_MdSz\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> ~\Anaconda3\Scripts\conda.exe env list
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --py
cwd: e:\VSCodeProjects\likelion
Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.
> ~\Anaconda3\Scripts\conda.exe info --json
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> pipenv --version
cwd: e:\VSCodeProjects\likelion
> pipenv --venv
cwd: e:\VSCodeProjects\likelion
> pipenv --py
cwd: e:\VSCodeProjects\likelion
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging
)
There was an error
console.ts:137 [Extension Host] Error Python Extension: 2019-09-17 02:20:13: Failed to parse interpreter information for 'C:\Users\Jaepil\.virtualenvs\likelion-WdsTZA1R\Scripts\python.exe' with JSON Traceback (most recent call last):
File "c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py", line 4, in <module>
import json
ModuleNotFoundError: No module named 'json' SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse (<anonymous>) at p.getInterpreterInformation (c:\Users\Jaepil\.vscode\extensions\ms-python.python-2019.9.34911\out\client\extension.js:75:291605)
Tried to look into it but I have no clue where to even start. It is just beyond my programming capability.
Yes maybe I can forget with all the “lost” virtualenv interpreters and move on but I really want a solution for this.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:18
Top GitHub Comments
Glad you were able to resolve this.
@DonJayamanne Thanks to your help and assistance, I could pinpoint the cause of the problem. It was because of Anaconda python in the virtualenv, which no longer was a valid Python interpreter since my Anaconda base Python has been upgraded to 3.7.3.
I’m not 100% sure why this was broken but it seems like upgrading Anaconda’s base Python (whether by upgrading by
conda upgrade conda
or by re-installing anaconda) breaks previous virtualenvs that used previous version of Anaconda Python as an interpreter.The weird behavior of Python not able to load even the simplest
json
package was due to these changes. Actually, it is unable to install any other packages sincepip
is also not working.I don’t know how but I think that’s why VSCode hid this virtualenv because it is no longer valid.
I learned it the hard way: Don’t use Conda’s Python if you don’t need it. I was using it to replace pyenv since it’s not supported in Windows but that was a wrong choice I guess.