Repository navigation
Terminal indicates (base) is activated when other env is selected #20885
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
triage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
WORKAROUND
Run command stated in https://github.com/microsoft/vscode-python/wiki/Activate-Environments-in-Terminal-Using-Environment-Variables#limitations
ISSUE
Testing #20884
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 Marlen Kyzy (@aiday-mar) in #20827 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
triage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team

Activity
karrtikr commentedon Mar 21, 2023
Hey Aiday Marlen Kyzy (@aiday-mar) , I created a separate issue to investigate. Can you check if the
.bashrcfile activates the base environment anywhere in it? It would be great if you can send me the.bashrcitself.bhavyaus commentedon Mar 21, 2023
On Windows and I also only see base activated when other env's are selected.
karrtikr commentedon Mar 21, 2023
Bhavya U (@bhavyaus) I see, can you provide the logs and check the powershell initialization script as suggested in #20885 (comment)?
karrtikr commentedon Mar 21, 2023
Right now there is an issue on VSCode due to which the shell initialization scripts (
.bashrcetc.) overrides what is set via VSCode, hence wrong environment can be activated depending on the script.aiday-mar commentedon Mar 22, 2023
Hey. Typing
echo $0into the terminal showed that I was using zsh. So I add here contents of the .zshrc file on my mac:karrtikr commentedon Mar 22, 2023
Perfect, thank you. As you can notice base environment is activated due to which this happens #20885 (comment). Try running:
in
zshand restarting the shell, and the issue should disappear.karrtikr commentedon Apr 5, 2023
Closing as it seems it is expected.
aiday-mar commentedon Apr 25, 2023
Hi Kartik Raj (@karrtikr), my apologies, I just saw your reply to my message. I'll be testing the fix today.
karrtikr commentedon Apr 25, 2023
Aiday Marlen Kyzy (@aiday-mar), as you've already tested #21102, this was tested as part of it. 🙂