question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue activating Python extension for Intellicode (looks like a venv interpreter detection issue)

See original GitHub issue

Environment data

  • VS Code version: Version: 1.54.3 (user setup)
  • Extension version (available under the Extensions sidebar): v2021.3.680753044
  • OS and version: Windows_NT x64 10.0.19042
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.7 CPython
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Relevant/affected Python packages and their versions: irrelevant
  • Relevant/affected Python-related VS Code extensions and their versions: Python: v2021.3.680753044 with Intellicode: v1.2.12, also the pairing Python: 2021.3.658691958 with Intellicode: v1.2.11 exhibits the same issue
  • Value of the python.languageServer setting: “Pylance”

[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

Intellicode loads properly

Actual behaviour

Error message as a notification : Sorry, something went wrong activating IntelliCode support for Python. Please check the “Python” and “VS IntelliCode” output windows for details.

Syntax coloration is partly broken (namely imports are not colored in green), autocompletion fails. The system python seems to work ok, but as soon as trying to change the interpreter there is an issue with the python interpreter not being recognized properly in the venv it seems.

Manually entering the path to the interpreter seems to work.

Steps to reproduce:

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

  1. Set interpreter to venv for workspace (manually if it is not auto detected)
  2. Close workspace
  3. Open workspace
  4. Issue is triggered

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 'pythonaa'
User belongs to experiment group 'pythonJediLSPcf'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonNotDisplayLinterPrompt'
User belongs to experiment group 'pythonDiscoveryModule'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
Error 2021-03-30 10:23:05: Fetching environments via the new API failed [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at Array.map (<anonymous>)
	at q.getInterpretersViaAPI (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39997)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async q.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39311)
	at async C.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:740434)]
Error 2021-03-30 10:23:05: Fetching environments via the new API failed [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at Array.map (<anonymous>)
	at q.getInterpretersViaAPI (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39997)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async q.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39311)
	at async C.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:740434)]
Error 2021-03-30 10:23:05: Fetching environments via the new API failed [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at Array.map (<anonymous>)
	at q.getInterpretersViaAPI (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39997)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async q.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39311)
	at async C.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:740434)]
Error 2021-03-30 10:23:05: Fetching environments via the new API failed [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at Array.map (<anonymous>)
	at q.getInterpretersViaAPI (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39997)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async q.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39311)
	at async g.onAutoSelectInterpreter (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:702846)
	at async g.autoSelectInterpreter (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:280746)]
Error 2021-03-30 10:23:05: Fetching environments via the new API failed [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at Array.map (<anonymous>)
	at q.getInterpretersViaAPI (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39997)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async q.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:39311)
	at async C.getInterpreters (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:740434)
	at async p.onAutoSelectInterpreter (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:705770)
	at async p.autoSelectInterpreter (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:280746)]
Error 2021-03-30 10:23:05: Python Extension: interpreterManager.refresh [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at q.getInterpreterDetails (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:38849)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async C.getInterpreterDetails (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:741545)
	at async f.updateDisplay (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:729765)
	at async f.refresh (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:729292)]
Error 2021-03-30 10:23:05: Failed to activate a workspace, Class name = y, completed in 374ms, has a falsy return value, Arg 1: <Uri:c:\Users\redacted\Documents\redacted\code\compiler\zonnx\exporter\export.py>, Return Value: undefined [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at q.getInterpreterDetails (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:38849)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async C.getInterpreterDetails (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:741545)
	at async _.activate (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:52:29881)
	at async Promise.all (index 4)
	at async y.activateWorkspace (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:52:25098)]
Error 2021-03-30 10:23:05: Failure during activation. [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at q.getInterpreterDetails (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:38849)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async C.getInterpreterDetails (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:741545)
	at async _.activate (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:52:29881)
	at async Promise.all (index 4)
	at async y.activateWorkspace (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:52:25098)]
Error 2021-03-30 10:23:05: sendStartupTelemetry() failed. [Error: invalid version -final
	at Object.u [as parseBasicVersion] (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:9:198256)
	at V (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:37379)
	at q.getInterpreterDetails (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:80:38849)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
	at async C.getInterpreterDetails (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:61:741545)
	at async _.activate (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:52:29881)
	at async Promise.all (index 4)
	at async y.activateWorkspace (c:\Users\redacted\.vscode\extensions\ms-python.python-2021.3.680753044\out\client\extension.js:52:25098)]
Python interpreter path: c:\Users\redacted\Documents\redacted\code\compiler\venv\Scripts\python.exe

Intellicode output:

Language server is set to Pylance.
Acquiring model
Acquiring model 'intellisense-members-lstm-pylance' for python
Querying IntelliCode service for available models.
vs-intellicode-python was passed a model: {}.
Cached model is up to date.
Activating Python extension
Error while activating Python: {}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

4reactions
ykiucommented, Apr 3, 2021

Experiencing the same issue.

Manually entering the path to the interpreter seems to work.

This worked for me, too. After executing the Python: Select Interpreter command from the command palette and specifying the right python interpreter, the syntax highlighting and the autocompletion recovered to normal.

0reactions
IceTDrinkercommented, Jun 1, 2021

This is probably stale as the issue did not seem to re-occur. Closing

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code does not detect Virtual Environments
The issue is that VSCode's Python extension by default uses the main python or python3 program while venv effectively creates a "new" python...
Read more >
Using Python environments in VS Code
Select and activate an environment. By default, the Python extension looks for and uses the first Python interpreter it finds in the system...
Read more >
Python Virtual Environments: A Primer
In this tutorial, you'll learn how to work with Python's venv module to create and manage separate virtual environments for your Python ......
Read more >
Setting Up Python Development Environments with Visual ...
This article is a brief tutorial of the VS Code setup for Python developments – the setup I use daily. Hopefully, this tutorial...
Read more >
Getting started with VS Code for Python: Setting up a ...
Then, go to Settings in VS Code and toggle the relevant setting (e.g. python.linting.flake8Enabled ) for the Python extension depending on what ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found