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.
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…
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
Python: Clear Cache and Reload Window
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.
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.
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…
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
Python: Clear Cache and Reload Window
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.