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

New shells activate conda base environment before activating python.pythonPath conda environment #12379

Closed
edwardleardi opened this issue Jun 16, 2020 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@edwardleardi
Copy link

Environment data

  • VS Code version: 1.45.1
  • Extension version (available under the Extensions sidebar): 2020.5.86806
  • OS and version: MacOS Catalina 10.15.5
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda Python 3.6 environment
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Jedi
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

In my workspace settings I have set:

"python.pythonPath": "/Users/me@home.com/opt/anaconda3/envs/pytorch/bin/python"

So I would expect every time I open a new shell in VS Code the shell runs conda activate pytorch.

Actual behaviour

Each time I open a new shell in the workspace I get this output (before running any commands manually):

source /Users/me@home.com/opt/anaconda3/bin/activate
conda activate pytorch
15:51:44 with me@home.com in pytorch on  master 
❯ source /Users/me@home.com/opt/anaconda3/bin/activate
(base) 15:51:44 with me@home.com in pytorch on  master 
❯ conda activate pytorch
(pytorch) 15:51:44 with me@home.com in pytorch on  master 
❯ 

Is there a reason the shell is running source /Users/me@home.com/opt/anaconda3/bin/activate before activating the pytorch environment? In my ~/.condarc I have auto_activate_base: false so I'm not sure why the base conda environment is being activated at all.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

["INFO" - 3:50:41 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 3:50:41 PM] Extension Version: 5.0.0.
["INFO" - 3:50:41 PM] Enabling prettier for languages
[
  "css",
  "graphql",
  "html",
  "javascript",
  "javascriptreact",
  "json",
  "json5",
  "jsonc",
  "less",
  "markdown",
  "mdx",
  "mongo",
  "postcss",
  "scss",
  "typescript",
  "typescriptreact",
  "vue",
  "yaml"
]
["INFO" - 3:50:41 PM] Enabling prettier for range supported languages
[
  "graphql",
  "javascript",
  "javascriptreact",
  "json",
  "typescript",
  "typescriptreact"
]


Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

XXXX

@edwardleardi edwardleardi added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jun 16, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jun 17, 2020
@karrtikr
Copy link

Yes, the extension sends that. It's because we have noticed some conda versions that the activation doesn't work unless base is activated first. Or if user has not configured his shell manually, this step does it for him.
I understand maybe you don't need that, but many of the users do (or atleast did). How is it causing problems for you?

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Jun 17, 2020
@karrtikr
Copy link

Perhaps #8870 might be of interest to you, if so, please upvote the issue.

@edwardleardi
Copy link
Author

Ah I see, thanks for the context @karrtikr. It's not necessarily causing me problems, just unexpected behavior to me. I have upvoted the issue you linked.

@ghost ghost removed the triage label Jun 18, 2020
@lucacerone
Copy link

@karrtikr when activating base is needed to make an environment works, it tipycally means one has a broken conda setup in the first place. Regardless of that, "source /bin/activate" has been deprecated by conda (see this post from anaconda's blog) and one should use "conda activate base" instead.

@karrtikr
Copy link

it tipycally means one has a broken conda setup

@lucacerone That may very well be true, however, we try our best to support all kinds of scenario. We've received complaints on our side which is why we went with that just to be safe.

@ghost
Copy link

ghost commented Aug 1, 2020

Update: I posted much of this comment as a general feature request here. Please upvote that if you would also like to be able to disable the automatic running of these two lines of code in every new terminal in a VS workspace that has Python extension activated.

I just started using VS Code to integrate my R and Python scripts in a single workspace. This "feature" of the Python extension is really annoying...

Okay, I understand why you may have built something that runs
[PATH]/anaconda3/Scripts/activate
and
conda activate base
when opening terminals that are intended to run python code... But after installing the Python extension, every single new terminal tries to run this code, even those that are not intended for use with python.

I do not need/want these commands to run automatically if I simply open an R terminal, a bash terminal, or some other terminal... Yet, in VS workspaces where the VS Code extension has been activated, these commands are sent every single time a new terminal is open.

Why?
How can we disable this?

Thank you!

@ghost
Copy link

ghost commented Aug 1, 2020

Perhaps #8870 might be of interest to you, if so, please upvote the issue.

Upvoted.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants