Caching interferes with detecting a new python interpreter
See original GitHub issueIssue Type: Bug
I’m changing my desired Python interpreter by putting it in $PATH. Because I’ve already used vscode for my workspace, the Python extension appears to be using the cached python interpreter (afaict that’s coming from state.vscdb -> ms-python.python -> PYTHON_ENV_INFO_CACHE). I don’t see any way to disable that caching. Ideally there would be some way to configure the extension to respect $PATH or disable caching.
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.12
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
- Value of the
python.languageServer
setting: Default
User Settings
defaultLS: {"defaultLSType":"Jedi"}
downloadLanguageServer: true
envFile: "<placeholder>"
venvPath: "<placeholder>"
venvFolders: "<placeholder>"
condaPath: "<placeholder>"
pipenvPath: "<placeholder>"
poetryPath: "<placeholder>"
languageServer: "Jedi"
linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: false
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"
sortImports
• args: "<placeholder>"
• path: "<placeholder>"
formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "autopep8"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"
testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: false
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true
terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"
experiments
• enabled: true
• optInto: []
• optOutFrom: []
insidersChannel: "off"
tensorBoard
• logDirectory: "<placeholder>"
Extension version: 2022.0.1814523869 VS Code version: Code 1.67.1 (da15b6fd3ef856477bf6f4fb29ba1b7af717770d, 2022-05-06T12:37:14.619Z) OS version: Darwin arm64 21.4.0 Restricted Mode: No
System Info
Item | Value |
---|---|
CPUs | Apple M1 Pro (10 x 24) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled |
Load (avg) | 3, 3, 2 |
Memory (System) | 16.00GB (0.44GB free) |
Process Argv | –extensions-dir /nix/store/53k4y7l6nb68m0j9iqmdzvgg6rxp2jsa-vscode-extensions/share/vscode/extensions . --crash-reporter-id 06f4509c-da16-4f2d-ac50-cffb467932e2 |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vsclangdf:30486550
Issue Analytics
- State:
- Created a year ago
- Comments:20
Top Results From Across the Web
Improvements to clearing of cached interpreter name #3033
Currently the display names of interpreters are cached for a period of 1day. This is done to avoid unnecessarily spawning Python processes ...
Read more >Prevent Python from caching the imported modules
in Python with IPython, I run into the trouble of cached imported modules. The problem is that instructions import module only reads the...
Read more >Configure a Python interpreter | PyCharm Documentation
Python interpreters can be configured for a new project or for the current project (you can create a new interpreter or use one...
Read more >Using Python environments in VS Code
Configuring Python Environments in Visual Studio Code. ... This will add the path to the Python interpreter from the new virtual environment to...
Read more >Frequently Encountered Pipenv Problems - Read the Docs
☤ An exception is raised during Locking dependencies… ¶ ... Run pipenv lock --clear and try again. The lock sequence caches results to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure, I think it’s better if you open it as a separate issue because of the amount of the verbose in this one. So as I understand your feature request would be: Respect
PATH
while selecting the interpreter if no interpreter has been explicitly specified by the userYou can list alternative options in the issue description, thanks!
So is that desirable behavior? Switching interpreters requires manually clearing extension storage and restarting extension host?
We just want a way to specify the interpreter for a single instance of code - is there any way to do that you would recommend or support? Ideally we could set the interpreter through python from
PATH
, or a command line flag or an env var would also work. A possible workaround would even be respectingpython.defaultInterpreterPath
in.vscode/settings.json
. Right now, even that setting won’t be respected without clearing workspace interpreter settings.