Skip to content

Allow for using the "old" source way of activating virtual environments #22289

Description

Via #22270 . We would probably offer a setting to let you choose "command" or "environment variables" as how we would do virtual environment activation. We could leave the "on"/"off" option as separate so that things can (potentially) work with the dedicated "Python Terminal" command.

Activity

  1. added
    area-environmentsFeatures relating to handling interpreter environments
    community askFeature request that the community expressed interest in
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Oct 23, 2023
  2. github-actions commented on Oct 23, 2023

    @github-actions

    Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

  3. brettcannon commented on Jan 11, 2024

    @brettcannon
    MemberAuthor

    Thank you to everyone who upvoted this issue! Since the community showed interest in this feature request we will leave this issue open as something to consider implementing at some point in the future.

    We do encourage people to continue 👍 the first/opening comment as it helps us prioritize our work based on what the community seems to want the most.

  4. EeyoreLee commented on Jan 30, 2024

    @EeyoreLee

    Brett Cannon (@brettcannon) - hi, does it mean the terminal will auto-activated with correct conda env without the setting conda config --set auto_activate_base False. Like auto run a command conda activate xxx when the terminal is first initialized.

  5. brettcannon commented on Jan 30, 2024

    @brettcannon
    MemberAuthor

    Like auto run a command conda activate xxx when the terminal is first initialized.

    This feature request would bring back the old way of activating environments as an option. If you're asking about the current way via environment variables, then please open a Discussion.

  6. MicaelJarniac commented on May 7, 2024

    @MicaelJarniac

    I need this! I've been using Zsh for Humans, and something about it just doesn't work at all with the new activation method. I think it's related to it running inside a headless tmux session, or something like that.

    The old way worked perfectly for me.

    Here's what's happening to me with this new method:

    Boring stuff
    ❯ which python
    /home/micael/.pyenv/shims/python
    ❯ which mypy
    /home/micael/projects/playground/.venv/bin/mypy
    ❯ echo $VIRTUAL_ENV
    
    ❯ echo $PATH
    /home/micael/.pyenv/shims:/home/micael/bin:/home/micael/.vscode/extensions/ms-python.python-2024.7.11281013/python_files/deactivate/zsh:/home/micael/projects/playground/.venv/bin:/home/micael/.pyenv/bin:/home/micael/.local/bin:/home/micael/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/micael/.cache/zsh4humans/v5/fzf/bin
    ❯ . .venv/bin/activate
    ❯ which python
    /home/micael/projects/playground/.venv/bin/python
    ❯ which mypy
    /home/micael/projects/playground/.venv/bin/mypy
    ❯ echo $VIRTUAL_ENV
    /home/micael/projects/playground/.venv
    ❯ echo $PATH
    /home/micael/projects/playground/.venv/bin:/home/micael/.pyenv/shims:/home/micael/bin:/home/micael/.vscode/extensions/ms-python.python-2024.7.11281013/python_files/deactivate/zsh:/home/micael/projects/playground/.venv/bin:/home/micael/.pyenv/bin:/home/micael/.local/bin:/home/micael/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/micael/.cache/zsh4humans/v5/fzf/bin

    Notice how which python and echo $VIRTUAL_ENV change after manually activating the venv. I also don't get the venv indicator on my prompt without activating manually.

  7. TheFlux7 commented on May 29, 2024

    @TheFlux7

    #11039 is still labelled as "experiment"

    So as a workaround, you can use the old source way of activating virtual environments by adding one of these options in your settings.json (from specific to general):

    • "python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]: it will disable this specific experiment
    • "python.experiments.enabled": false: it will disable all python experiments
    • "telemetry.telemetryLevel": "off": it will opt you out of A/B testing from VS Code and all other Microsoft extensions
  8. eleanorjboyd commented on Dec 8, 2025

    @eleanorjboyd
    Member

    Hi there! 👋
    Please see this document for all the ways to configure activation here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-environmentsFeatures relating to handling interpreter environmentscommunity askFeature request that the community expressed interest infeature-requestRequest for new features or functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions