You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refreshing packages conflict with local script to remove venv #2054
We have custom scripts to build and clean (remove) the virtual environment. When we clean the virtual environment, the vscode-python-environments extension notices this and starts examing it using command: .venv\Scripts\python.exe -m pip list --format=json --not-required --disable-pip-version-check.
The venv is being deleted, so this causes to abort our script with an error: rm: cannot remove '../app/.venv/Lib/site-packages/pip/_internal/utils/misc.py': Device or resource busy
At the same time the extensions reports an error: Error refreshing packages (Source: Python Environments).
Suggested fix
I noticed there is a setting python-envs.packageWatchers. This fixes the issue, but is only allowed as a user setting. I want it to be configurable as a workspace setting, so anyone who works with this workspace doesn't have to set a user setting on their own.
The extension not only conflicts when removing the venv, but also when building the venv. The output from the extension shows that it runs: python: c:\Data\...\app\.venv\Scripts\python.exe: No module named pip. Of course, this is a timing related issue.
The suggested fix solves this problem as well. Or at least, is a good workaroung for us.
By the way: Is there a possibility to disable the virtual environments extension as a whole for a workspace? The python.useEnvironmentsExtension is just a temporary setting and is also not configurable as a workspace setting either. Suppose, if more issues are coming up, I'd like to be able to just disable the extension and do activation in the terminal ourselves. It is not working properly. Newly opened PowerShell terminals in a multi-root workspace are not activated for instance.
Activity
marcel-22 commentedon Nov 25, 2026
The extension not only conflicts when removing the venv, but also when building the venv. The output from the extension shows that it runs:
python: c:\Data\...\app\.venv\Scripts\python.exe: No module named pip. Of course, this is a timing related issue.The suggested fix solves this problem as well. Or at least, is a good workaroung for us.
marcel-22 commentedon Nov 25, 2026
By the way: Is there a possibility to disable the virtual environments extension as a whole for a workspace? The
python.useEnvironmentsExtensionis just a temporary setting and is also not configurable as a workspace setting either. Suppose, if more issues are coming up, I'd like to be able to just disable the extension and do activation in the terminal ourselves. It is not working properly. Newly opened PowerShell terminals in a multi-root workspace are not activated for instance.