Skip to content

Python interpreter not being recognized "No Python interpreter is selected" (JSON parsing fail) #9484

Closed
@astrowonk

Description

@astrowonk

Environment data

  • VS Code version: 1.41.1
  • Extension version (available under the Extensions sidebar): 2020.1.57204
  • OS and version: RHEL 7
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.2 (miniconda)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): XXX
  • Relevant/affected Python packages and their versions: XXX
  • 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): language server

Expected behaviour

VS Code to recognize Python 3.7.2 from its location in /opt/miniconda/bin as it has always done

Actual behaviour

GUI and console claim that no interpreter selected. Debugger doesn't seem to run correctly.

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Launch VS Code. Open python file. VS Code prompts for python interperter. GUI pop-up does not list python 3.7 in /opt/miniconda/bin as it did previously.

Logs

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

Starting Microsoft Python language server.
Starting Microsoft Python language server.
> conda run -n base python ~/.vscode/extensions/ms-python.python-2020.1.57204/pythonFiles/interpreterInfo.py
> conda run -n base python ~/.vscode/extensions/ms-python.python-2020.1.57204/pythonFiles/interpreterInfo.py
> conda run -n base python ~/.vscode/extensions/ms-python.python-2020.1.57204/pythonFiles/interpreterInfo.py
> conda run -n base python ~/.vscode/extensions/ms-python.python-2020.1.57204/pythonFiles/interpreterInfo.py
> conda run -n base python -c "import sys;print(sys.prefix)"
cwd: ~/checkouts
> conda run -n base python -c "import sys;print(sys.prefix)"
cwd: ~/checkouts
> conda run -n base python -c "import sys;print(sys.executable)"
cwd: ~/checkouts
> conda run -n base python -c "import sys;print(sys.executable)"
cwd: ~/checkouts
> conda run -n base python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/checkouts
> conda run -n base python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/checkouts
> conda run -n base python -m site --user-site
cwd: ~/checkouts
> conda run -n base python -m site --user-site
cwd: ~/checkouts
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.

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)

Error Python Extension: 2020-01-09 10:01:03: Failed to parse interpreter information for '/opt/miniconda/bin/python3.7' with JSON --timed out-- [SyntaxError: Unexpected number in JSON at position 1
	at JSON.parse (<anonymous>)
	at s.getInterpreterInformation (/home/mhuerta/.vscode/extensions/ms-python.python-2020.1.57204/out/client/extension.js:1:442879)
	at async getInterpreterInformation (/home/mhuerta/.vscode/extensions/ms-python.python-2020.1.57204/out/client/extension.js:75:1187651)
	at async Promise.all (index 0)
	at async C.collectInterpreterDetails (/home/mhuerta/.vscode/extensions/ms-python.python-2020.1.57204/out/client/extension.js:75:1194494)]

I can type conda run -n base python ~/.vscode/extensions/ms-python.python-2020.1.57204/pythonFiles/interpreterInfo.py on the command line and it returns:

{"versionInfo": [3, 7, 2, "final"], "sysPrefix": "/opt/miniconda", "version": "3.7.2 (default, Dec 29 2018, 06:19:36) \n[GCC 7.3.0]", "is64Bit": true}

so I'm not sure why that's problematic JSON.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions