How to flush interpreters list cache?

Question:

I initialized a virtualenv with a python 2.7 interpreter, and then selected it as the interpreter in VSCode.

I then changed the virtualenv interpreter to python 3.7, and the VSCode interpreter list does not reflects the change: it still shows the virtualenv interpreter as being python 2.7.

How can I force the cached interpreter list to be updated or flushed?

This is related to this issue.

Asked By: Josselin

||

Answers:

At last I found a way to remove no-longer existing interpreters from the cache :

  • close VSCode
  • delete the virtualenv
  • launch VSCode and try to select the no-longer existing interpreter

I guess the lookup is only done at launch, and not upon interpreter selection…

Answered By: Josselin

Running those 2 commands in the command palette worked for me.

  • Python: Clear Workspace Interpreter Setting
  • Python: Reset Stored Info for Untrusted Interpreters

As mentioned in the GitHub issue here
Kudos to ericsnowcurrently

Answered By: Kop3sh

Python: Clear Cache and Reload Window

Answered By: hotari

According to this comment, as of October 2021 it is possible to refresh the list of interpreters by doing F1, typing "Python: Select interpreter", and clicking on the circular arrow icon in the top-left corner of the menu.

refresh Python interpreters

Answered By: cbenz
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.