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

Terminal indicates (base) is activated when other env is selected #20885

Closed
karrtikr opened this issue Mar 21, 2023 · 9 comments
Closed

Terminal indicates (base) is activated when other env is selected #20885

karrtikr opened this issue Mar 21, 2023 · 9 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@karrtikr
Copy link

karrtikr commented Mar 21, 2023

WORKAROUND

Run command stated in https://github.com/microsoft/vscode-python/wiki/Activate-Environments-in-Terminal-Using-Environment-Variables#limitations

ISSUE

Testing #20884

image

Hi,

I am testing your test-plan item. Running the script shows indeed that I was using the conda environment I created however inside of the terminal in the parentheses it was still written (base) inside of ('testmarch':conda) or (testmarch) as I would have expected. I was using the inbuilt terminal inside of VS Code, I am on macOS 13.2.1, the output under the python category is in the output view is as follows. Perhaps I have configured incorrectly the test?

Experiment 'pythonTerminalEnvVarActivation' is active
Experiment 'pythonPromptNewToolsExt' is active
> conda info --json
Python interpreter path: /usr/bin/python3
> ~/.conda/bin/conda info --json
> ~/miniconda3/bin/conda info --json
> /usr/bin/python3 -I ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 -I ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/interpreterInfo.py
> ~/miniconda3/bin/python -I ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/interpreterInfo.py
> ~/miniconda3/envs/testmarch/bin/python -I ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/interpreterInfo.py
Starting Pylance language server.
Python interpreter path: ~/miniconda3/envs/testmarch/bin/python
> conda info --json
shell: zsh
> ~/miniconda3/bin/conda run -n testmarch --no-capture-output python ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/printEnvVariables.py
shell: bash
> ~/.conda/bin/conda info --json
shell: zsh
> ~/miniconda3/bin/conda info --json
shell: zsh
> ~/miniconda3/bin/conda run -n testmarch --no-capture-output python ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2023.5.10791707/pythonFiles/printEnvVariables.py
shell: zsh
Send text to terminal: /Users/aiday/miniconda3/envs/testmarch/bin/python /Users/aiday/Desktop/TestingFiles/python/script.py
Send text to terminal: /Users/aiday/miniconda3/envs/testmarch/bin/python /Users/aiday/Desktop/TestingFiles/python/script.py

Originally posted by @aiday-mar in #20827 (comment)

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Mar 21, 2023
@karrtikr
Copy link
Author

Hey @aiday-mar , I created a separate issue to investigate. Can you check if the .bashrc file activates the base environment anywhere in it? It would be great if you can send me the .bashrc itself.

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Mar 21, 2023
@bhavyaus
Copy link

On Windows and I also only see base activated when other env's are selected.

image

@karrtikr
Copy link
Author

@bhavyaus I see, can you provide the logs and check the powershell initialization script as suggested in #20885 (comment)?

@karrtikr
Copy link
Author

Right now there is an issue on VSCode due to which the shell initialization scripts (.bashrc etc.) overrides what is set via VSCode, hence wrong environment can be activated depending on the script.

@aiday-mar
Copy link

aiday-mar commented Mar 22, 2023

Hey. Typing echo $0 into the terminal showed that I was using zsh. So I add here contents of the .zshrc file on my mac:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/aiday/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/aiday/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/aiday/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/aiday/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Mar 22, 2023
@karrtikr
Copy link
Author

karrtikr commented Mar 22, 2023

Perfect, thank you. As you can notice base environment is activated due to which this happens #20885 (comment). Try running:

conda config --set auto_activate_base False

in zsh and restarting the shell, and the issue should disappear.

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Mar 22, 2023
@karrtikr
Copy link
Author

karrtikr commented Apr 5, 2023

Closing as it seems it is expected.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2023
@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Apr 5, 2023
@aiday-mar
Copy link

aiday-mar commented Apr 25, 2023

Hi @karrtikr, my apologies, I just saw your reply to my message. I'll be testing the fix today.

@karrtikr
Copy link
Author

@aiday-mar, as you've already tested #21102, this was tested as part of it. 🙂

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants