0

In my Windows Command Prompt, if I run activate <env-name> it activates the environment without any issue. However, in other terminals for example Git Bash, the activate <env-name> does not work. I have to explicitly prepend conda infront of the command, like, conda activate <env-name>.

I need Git Bash to work with activate <env-name> because I did setup Git Bash as the default terminal in my VS Code and whenever I initiate a terminal from inside VS Code, it opens up Git Bash session and tries to execute activate <env-name>, eventually failing to activate my intended environment automatically.

Any help is appreciated.

Nuhil Mehdy
  • 2,424
  • 1
  • 21
  • 23

1 Answers1

0

I'm not exactly sure about the Windows folder configuration (Windows users please chime in), but the activate script is installed in the base environment's bin/ and/or the Scripts/ directory. Generally, it is recommended to transition to conda activate since Conda v4.4. However, this is slightly complicated on Windows + Git Bash, for which the standard conda init bash does not directly work, but there are directions in this question on getting it working.

Alternatively, one could set up an alias to in the .bashrc file that Git Bash loads,

echo 'alias activate=/path/to/conda/bin/activate' >> ~/.bashrc

Just be aware that this is a non-standard practice, and Conda may not continue to deliver the activate script.

merv
  • 67,214
  • 13
  • 180
  • 245