Skip to content

Conda activation does not work in Terminal #5764

Description

Environment data

  • VS Code version: Stable/Insiders
  • Extension version (available under the Extensions sidebar): N/A
  • OS and version: Mac
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda 4.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Conda
  • Relevant/affected Python packages and their versions: N/A

Expected behaviour

When a conda environment activated using conda activate xxx, then using python xxx will point to the activated environment.

Actual behaviour

Even though a conda environment has been activated, which python will point to the wrong environment.

Steps to reproduce:

  1. Open terminal (without python extenions)
  2. Run command conda activate xxx
  3. Run command which python

Tracked here #5344
Upstream issue microsoft/vscode#70248

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on May 24, 2019
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on May 24, 2019
  3. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on May 24, 2019
  4. changed the title [-]Even though conda env is activated `python` points to default `python` interpreter[/-] [+]Conda activation does not work in Terminal[/+] on May 24, 2019
  5. djnsu commented on Jun 4, 2019

    @djnsu

    I have exactly the same problem. Conda env activation doesnt't work from vscode, but works fine from iTerm/Terminal.

  6. AlexTaguchi commented on Jun 5, 2019

    @AlexTaguchi

    I seem to be having the same problem (identical to microsoft/vscode#72188)

  7. 12 remaining items

  8. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Sep 16, 2019
  9. luabud commented on Sep 17, 2019

    @luabud
    Member

    Don Jayamanne (@DonJayamanne) would the proposed solution below work? Do you think this could cause problems for those who are not using conda?

    • Check if "terminal.integrated.inheritEnv" is set on the user's user settings
    • If not, then set it to false
  10. DonJayamanne commented on Sep 17, 2019

    @DonJayamanne
    Author

    Yes we can do that, however I'm tempted to do the following:

    • Prompt and change the setting in user settings.json
    • Ask user to exit vscode and reload it (Not sure restarting VS Code will work).

    Changing settings without users consent is not something we should be doing.

    would the proposed solution below work?

    Yes. My suggestion is to do this ONLY when user is using conda. Not otherwise. I.e. minimize the number of users that will be impacted by this change.

    Do you think this could cause problems for those who are not using conda?

    Not that I'm aware of. We can find out.

  11. DonJayamanne commented on Sep 17, 2019

    @DonJayamanne
    Author

    See PR in progress #6959

  12. luabud commented on Sep 19, 2019

    @luabud
    Member

    Prescribed solution

    Cool, so if it isn't a Windows machine and if the selected interpreter is a conda environment and "terminal.integrated.inheritEnv" is not set on the user's user settings, we can prompt the message below:

    "We noticed you're using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we suggest the "terminal.integrated.inheritEnv" setting to be changed to false. Would you like to update this setting?"
    Options: Yes, No

    And add telemetry for the yes selection, so we can know if this is actually solving the issue.

  13. luabud commented on Oct 8, 2019

    @luabud
    Member

    Closing in favour of #7607

  14. ghost removed on Oct 8, 2019
  15. locked as resolved and limited conversation to collaborators on Oct 15, 2019
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-terminalbugIssue identified by VS Code Team member as probable bugregressionBug didn't exist in a previous release

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions