Josselin
Josselin

Reputation: 442

How to flush interpreters list cache?

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.

Upvotes: 19

Views: 28799

Answers (4)

cbenz
cbenz

Reputation: 365

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

Upvotes: 3

Kop3sh
Kop3sh

Reputation: 695

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

Upvotes: 10

hotari
hotari

Reputation: 105

Python: Clear Cache and Reload Window

Upvotes: 7

Josselin
Josselin

Reputation: 442

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...

Upvotes: 12

Related Questions