0

I've recently refreshed my Git Bash and Anaconda installation, and I am trying to run Git Bash from within VSCode with Anaconda. The issue is that whenever I open the integrated terminal from within VSCode, the terminal does not show up with a (base) tag and when I run conda activate, it returns the CommandNotFoundError:

If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - cmd.exe
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

I have followed the instructions with conda init bash and restarted the shell, but it keeps giving this error. I've seen a couple other articles, but most of them are outdated and the others have no solutions that work. Anaconda still works on external Git Bash when I don't use the integrated terminal. Any help is greatly appreciated.

1

You can run source activate base to get it up and running, can't get the bash script to run in VSCode using bash terminal tho. If someone finds out plz halp....

more refs...

https://www.anaconda.com/conda-4-6-release/

0

When you've run conda init bash it probably created a ~/.bash_profile file. If you want the git bash terminal from VS Code to know about it, then do the following on a git bash terminal:

echo '. ${HOME}/.bash_profile' >> ~/.bashrc

That adds whichever command anaconda added to the .bash_profile also into the .bashrc (which is executed for interactive non-login shells - and that's what VS Codes gets), whereas .bash_profile is for login shells (which is what git bash runs everytime a new terminal opens). There's more information about the differences between .bashrc and .bash_profile on another SE question.

Note: If you have experience with these files, then you could copy the bits from .bash_profile that you need instead of sourcing all the commands you may have in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.