Streamlined Python Environment Management in VS Code: The New Environments Extension

By • min read

Python developers using Visual Studio Code can now enjoy a unified and streamlined workflow for managing environments, interpreters, and packages. The newly released Python Environments extension brings consistency and clarity to a historically fragmented ecosystem of tools like venv, conda, pyenv, poetry, and pipenv. After a year in preview—refined through extensive community feedback and real-world usage—the extension is now generally available. In the coming weeks, all environment workflows will automatically switch to this extension, or users can opt in immediately by setting python.useEnvsExtension to true. The extension works seamlessly alongside the Python extension and requires no setup; simply open a Python file, and your environments are discovered automatically.

A Unified Environment Experience

The extension automatically discovers environments from all major managers:

Streamlined Python Environment Management in VS Code: The New Environments Extension
Source: devblogs.microsoft.com

Discovery is powered by PET (Python Environment Tool), a fast Rust-based scanner that reliably identifies environments across platforms by checking your PATH, known installation locations, and configurable search paths. PET already powers environment discovery in the standard Python extension—this new extension builds a dedicated UI around the same proven engine. You can create, delete, switch, and manage environments from a single interface, regardless of which tool originally created them.

For most users, everything works out of the box. If your environments reside in non-standard locations, you can configure workspace-level search paths using glob patterns, or set global search paths for shared directories outside your workspace.

Faster Environment Creation with uv

If you have uv installed, the extension automatically uses it for creating venv environments and installing packages. This results in significantly faster performance compared to standard tools, especially in large projects. The feature is enabled by default via the python-envs.alwaysUseUv setting.

Quick Create and Custom Create

Getting a new environment up and running is now just a click away. Quick Create (the + button in the Environment Managers view) builds an environment using your default manager, the latest Python version, and any workspace dependencies it finds in requirements.txt or pyproject.toml. You get a working environment in seconds.

When you need more control, Custom Create (accessible via Python: Create Environment in the Command Palette) lets you choose your environment manager, Python version, environment name, and which dependency files to install from. Both venv and conda support direct creation from within VS Code; for other managers like pyenv, poetry, and pipenv, the extension discovers environments you create using their respective CLI tools.

Streamlined Python Environment Management in VS Code: The New Environments Extension
Source: devblogs.microsoft.com

Python Projects: Environments That Match Your Code Structure

One of the standout features of the Python Environments extension is Python Projects, which let you map environments to specific folders or files. This solves common problems in monorepos, where different subdirectories may require different Python versions or dependency sets. Instead of manually switching environments or relying on fragile global configurations, you can define project-level environment associations that are automatically recognized by VS Code.

For example, you can have one folder using a conda environment with Python 3.9 and another using a venv with Python 3.11—the extension keeps them separate and applies the correct environment when you open or edit files in each folder. This feature is especially valuable for teams working on multiple interdependent projects within a single repository, as it eliminates confusion about which environment is active for a given task.

To take full advantage of Python Projects, simply open your workspace and the extension will offer to create or associate environments based on your project structure. You can also manually assign environments through the Environment Managers view. This level of granularity makes the extension suitable for both small scripts and large-scale enterprise codebases.

The Python Environments extension represents a major step forward in simplifying Python development in VS Code. With automatic discovery, faster creation via uv, and project-specific mappings, it addresses long-standing pain points and brings a modern, intuitive workflow to environment management. Try it today by enabling the python.useEnvsExtension setting, and experience a more cohesive Python development environment.

Recommended

Discover More

How Microsoft Discovery Is Transforming R&D with Agentic AIUnmasking Silver Fox: New ABCDoor Backdoor Targets Tax Authorities in Russia and IndiaThe Copy Fail Vulnerability: 8 Essential Facts You Must KnowHow to Thrive as an AI Startup When Big Tech DominatesThe Hidden Cost of AI Friendliness: 7 Critical Facts from Oxford Research