Skip to content

Show create venv when users attempt to install packages to global #41

Description

No description provided.

Activity

  1. edvilme commented on Sep 30, 2026

    @edvilme
    Contributor

    Proposed workflow

    When a user installs packages through the extension, we should check the environment before running the installation.

    If the target is a global environment, prompt the user to:
    a) Create new virtual environment with the requested packages (quickCreate)
    b) Use an existing virtual environment, then install the packages
    c) Continue globally, keeping the original installation target
    Dismissing the prompt should cancel the installation

    Requests targeting a virtual environment should proceed normally

  2. vs-code-engineering commented on Oct 29, 2026

    @vs-code-engineering

    Sharing media and context from merged PR #1842 for verification:

    Image

    This pull request introduces a new workflow for package installation that helps users avoid installing packages into global Python environments by offering alternatives, such as creating or selecting a virtual environment. The changes affect the package management commands, their APIs, and the handling of package versions. Additionally, the codebase has been refactored for clarity and improved error handling, especially for Python 2 environments.

    Global Environment Package Installation Workflow:

    • Added a new helper (selectPackageManagementEnvironment in src/features/nonGlobalPackageInstallationEnvironment.ts) that prompts users to create or select a virtual environment when attempting to install packages into a global environment, reducing the risk of polluting global Python installations.
    • Updated the main API (managePackages in src/extensionApi.ts) and package version management command (managePackageVersion in src/features/envCommands.ts) to use this helper, ensuring that package installations prompt users appropriately and respect their choices. [1] [2] [3]

    Error Handling and Compatibility:

    • Improved error handling in the pip package manager to explicitly reject operations on Python 2 environments, preventing deprecated usage.

    Refactoring and Code Quality:

    • Refactored imports and formatting in several files for clarity and maintainability, and updated test stubs to cover the new workflow. [1] [2] [3]

    These changes collectively improve package management UX and reliability, especially around global environment safety.

    Source PR: #1842

  3. added a commit that references this issue on Nov 3, 2026
    62c4783
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunities

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions