Conda activate doesn't work in bash file

I’ve installed Qiime2 2020.8 in a conda environment and followed all the steps on When I activate Qiime2 in the terminal (using conda activate qiime2-2020.8) all goes well, but when I try to run this command from within a bash file, it gives me an error message saying

CommandNotFound: Your shell has not been properly configured to use ‘conda activate’.
To initialize your shell, run
$ conda init {SHELL_NAME}

When I do this, there is no action taken, implying it should all be fine. Again, this works for activating in the shell, but not for activating in a bash file. Does anyone know how to solve this? Thanks in advance!

Hello @aliciaocke. Try using source activate qiime2-2020.8 instead of conda activate qiime2-2020.8 in your bash script. If that doesn’t work, try add the line source ~/miniconda3/etc/profile.d/ before your conda activate. Thank you.


This worked for me, thanks! I also removed the bash extention from the file in order to make this work, in case other people also didn’t know conda activate doesn’t work in bash files.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.