Codenil

April 2026 Update for VS Code Python Environments: Key Changes and FAQs

Published: 2026-05-04 02:37:12 | Category: Science & Space

The April 2026 update to the Python Environments extension for Visual Studio Code introduces significant improvements in startup speed, reliability, and terminal handling. Below we answer the most common questions about these changes, with deeper dives into specific features.

1. What improvements were made to startup performance?

The update makes activation noticeably faster, especially on remote and containerized workspaces. Three key changes deliver this:

April 2026 Update for VS Code Python Environments: Key Changes and FAQs
Source: devblogs.microsoft.com
  • Lazy manager discovery – Pipenv, pyenv, and poetry environments are no longer checked on startup. Detection happens only when you interact with those managers (e.g., opening a Pipfile or pyproject.toml with a poetry backend). This avoids wasted work for most users who rely on venv, uv, or conda. (#1423, #1408)
  • Faster environment resolution – The path from extension activation to interpreter readiness is shorter, with less overhead during startup and interpreter selection. (#1419)
  • Narrower default workspace scanning – The previous pattern ./**/.venv caused deep recursion, leading to 30-second hangs in large projects and Remote-SSH sessions. The new default is .venv and */.venv, covering standard layouts without deep traversal. If your environments are nested deeper, add custom paths via the python-envs.workspaceSearchPaths setting. (#1419, #1460, #1434)

2. How has the extension’s reliability been improved?

Two critical fixes enhance reliability:

  • PET crash recovery – Previously, a crash of the PET process during a refresh left the extension in a broken state with no environments visible. Now the extension retries the refresh after a crash and handles empty or malformed responses defensively, preventing a permanent blank environment list. (#1442, #1447, #1444)
  • Conda base environment fix – After a window reload, the conda base environment could be incorrectly restored as a different named environment, making your interpreter selection appear to change silently. This bug is now fixed. (#1412)

3. What environment-related changes were made for terminals?

Two terminal improvements streamline your workflow:

  • Auto-refreshing package lists – After running pip install or pip uninstall, the package view updates automatically by watching metadata changes in site-packages. No more manual refreshes. (#1420)
  • Multi-project terminal creation – In workspaces with multiple Python projects, creating a new terminal now prompts you to choose which project’s environment to activate, instead of silently picking one. (#1401)

4. How does lazy manager discovery work in practice?

Previously, the extension eagerly scanned for all supported environment managers (Pipenv, pyenv, poetry) on every startup, even if you never used them. This consumed resources. With lazy discovery, the extension only checks for a manager when it encounters a project file associated with that manager—for example, a Pipfile for Pipenv or a pyproject.toml with a poetry backend. For the majority of users who stick with venv, uv, or conda, those extra scans are completely eliminated, resulting in a faster startup. If you later open a project that uses a lazy-discovered manager, detection happens on-demand. This optimization is especially beneficial in remote and containerized workspaces where startup overhead is more noticeable.

5. Why was the default workspace scanning changed, and what should I do if my environments are nested deeper?

The old default ./**/.venv performed a recursive scan of the entire workspace tree. On large projects—especially over Remote-SSH—this could cause the PET process to hang for 30 seconds or more during configuration, leading to timeouts and restart loops. The new default is .venv (top-level only) and */.venv (one level deep), which covers the most common folder layouts. If you store virtual environments more than one level deep (e.g., backend/envs/.venv), you can add custom paths to the python-envs.workspaceSearchPaths setting. This ensures fast startup without breaking existing setups—simply configure your specific nesting pattern.

6. What was the Conda base environment issue and how is it fixed?

After reloading the VS Code window, the extension could mistakenly restore the Conda base environment as a different named environment. For example, if you had selected the base environment before reload, you might see it appear as “myenv” instead, causing confusion and making your interpreter selection appear to silently change. The root cause was an incorrect mapping during environment restoration. The fix ensures that the base environment is always correctly identified and restored after a window reload, so your previously selected interpreter remains consistent. This bug was reported in issue #1412 and is now resolved, providing a smoother experience for Conda users.

7. How does the extension handle PET process crashes now?

The PET (Python Environment Tools) process is responsible for gathering environment information. If it crashes mid-refresh, the extension could previously become stuck in a broken state with an empty environment list—no interpreters, no packages visible. The update adds two defensive measures:

  • Automatic retry – The extension retries the refresh after a crash, so a transient failure (e.g., memory spike) no longer permanently breaks the UI.
  • Malformed response handling – Empty or corrupted responses are ignored gracefully, preventing the environment list from becoming blank. This means you won’t have to restart VS Code or reload the window after a PET crash. (Issues #1442, #1447, #1444)

8. What are the new terminal and package list features?

Two quality-of-life additions improve terminal and package management:

  • Auto-refreshing package lists – Previously, after installing or uninstalling packages via the terminal (e.g., pip install requests), you had to manually click the refresh button in the packages view. The extension now watches for metadata changes in the site-packages directory and updates the package list automatically. (#1420)
  • Multi-project terminal creation – In workspaces containing multiple Python projects (e.g., a monorepo with frontend/ and backend/), creating a new integrated terminal now shows a picker asking which project’s environment to activate. This eliminates the old silent selection behavior, ensuring you always activate the correct environment. (#1401)
  • Additionally, PowerShell activation on Windows now sets a process-scoped execution policy before running the activation script, preventing failures caused by restrictive system policies.