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.

Improvements to clearing of cached interpreter name

See original GitHub issue

Currently the display names of interpreters are cached for a period of 1day. This is done to avoid unnecessarily spawning Python processes for each interpreter every time the extension loads (i.e. every time a new workspace is opened or VSC is reloaded). Note: The cache also expires if the python executable file has changed since the last reload.

However, this can cause some confusions:

  • Assume user has python 3.6 installed in a directory named /anaconda3/bin
  • Next user updates the above environment to python 3.7.
  • Our code does not detect any changes to the above executable and the path is still the same.
  • Hence the cached display name is still used (and its incorrect, user sees 3.6 when its supposed to be 3.7). *** This confuses the user**

Solutions:

  • Remove caching of these display names completely
    • We’ll end up spawning processes unnecessarily every time VSC loads
  • Add some kind of the UI element to the top of the list of interpreters
    • This would read Don't find what you're looking for, click Refresh [Refresh]
    • Basically this is a way to tell the extension to re-load all interpreters and clear the cache
    • This also solves the problem of the user NOT having to reload VS Code if they create a new environment (e.g. a new Conda Environment or the like).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:12

github_iconTop GitHub Comments

4reactions
malone6commented, Jul 26, 2019

Just fyi if anyone else wants to fiddle wich cache: Within vscode, under help > developer tools > application you can access the local storage where environment names are cached. I deleted the desired cached items. After restarting vscode, my problem was solved.

According to your description. I access local storage, but it is empty

I have solved this problem, use the following method: manage extensions > disable Python extension > restart > enable python extension> restart then all python envs have been flushed(invalid pythonpath disappeared and new pythonpath displayed)

4reactions
flurin-conradincommented, Feb 6, 2019

Thanks for your answer. I described my problem here: https://github.com/Microsoft/vscode-python/issues/4298 Basically when I run Python: Select Interpreter environments that do not exist anymore are shown and vscode crashes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent Python from caching the imported modules
I would like something like that. A good alternative would be for IPython to restart, or restart the Python interpreter somehow. So, if...
Read more >
Caching in GitLab CI/CD
Each time you clear the cache manually, the internal cache name is updated. The name uses the format cache-<index> , and the index...
Read more >
Clearing cache via UI in translated language resets config ...
Problem/Motivation. I translated field labels through the configuration translation module UI. When I create a node and then translate it ...
Read more >
Modules are cached - Python Morsels
How to clear the cache for a module. This module caching that Python does is a feature, not a bug: Python does this...
Read more >
VS Code Tip | How to delete cached data files - YouTube
In this tutorial we are going to learn how to clear the cache content in Visual Studio Code in case if your VS...
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