Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conda activation does not work in Terminal #5764

Closed
DonJayamanne opened this issue May 24, 2019 · 11 comments
Closed

Conda activation does not work in Terminal #5764

DonJayamanne opened this issue May 24, 2019 · 11 comments
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@DonJayamanne
Copy link

DonJayamanne commented May 24, 2019

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

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label May 24, 2019
@DonJayamanne DonJayamanne added area-terminal needs upstream fix regression Bug didn't exist in a previous release bug Issue identified by VS Code Team member as probable bug labels May 24, 2019
@ghost ghost removed triage-needed Needs assignment to the proper sub-team labels May 24, 2019
@DonJayamanne DonJayamanne changed the title Even though conda env is activated python points to default python interpreter Conda activation does not work in Terminal May 24, 2019
@djnsu
Copy link

djnsu commented Jun 4, 2019

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

@AlexTaguchi
Copy link

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

@DonJayamanne DonJayamanne mentioned this issue Jun 13, 2019
24 tasks
@DonJayamanne DonJayamanne self-assigned this Jun 13, 2019
@DonJayamanne DonJayamanne added this to the 2019 - June Sprint 12 milestone Jun 13, 2019
@ericsnowcurrently ericsnowcurrently removed this from the 2019 - June Sprint 12 milestone Jun 26, 2019
@brettcannon brettcannon added this to the 2019 - June Sprint 13 milestone Jun 26, 2019
@DonJayamanne DonJayamanne removed this from the 2019 - June Sprint 13 milestone Jul 17, 2019
@Co2Link
Copy link

Co2Link commented Jul 24, 2019

OS: windows10
select 'Command Prompt' as Default shell fix my problem

@siriusmax
Copy link

Same problem. Wonder how to solve it in macos

@siriusmax
Copy link

siriusmax commented Jul 27, 2019

checking off the 'inherit Env' in settings solved this issue on my mac

@DonJayamanne DonJayamanne added this to the 2019 - July Sprint 15 milestone Jul 31, 2019
@DonJayamanne DonJayamanne removed this from the 2019 - July Sprint 15 milestone Aug 14, 2019
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Sep 16, 2019
@brettcannon brettcannon added the needs proposal Need to make some design decisions label Sep 16, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 16, 2019
@brettcannon brettcannon added this to the 2019 - September Sprint 2 milestone Sep 16, 2019
@luabud
Copy link
Member

luabud commented Sep 17, 2019

@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

@DonJayamanne
Copy link
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.

@DonJayamanne
Copy link
Author

See PR in progress #6959

@luabud
Copy link
Member

luabud commented Sep 19, 2019

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.

@luabud
Copy link
Member

luabud commented Oct 8, 2019

Closing in favour of #7607

@luabud luabud closed this as completed Oct 8, 2019
@ghost ghost removed the needs PR label Oct 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

8 participants