In the part of my bash script I need to switch to specific conda environment to use package that had been installed specifictly in this environment:
#!/bin/bash
home="$PWD"
# activate VINA 1.2.3
conda activate vina
vina --some_in --some_out
# go back to default environment
conda deactivate
While this works fine simply in the terminal (I am using MacOSX) the sh script executing the same commands produces the following errors:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
I've tried to use
conda init bash && conda deactivate
which works fine in the terminal but did not solve the problem in the sh script How I could properly switch between different conda environemnts in the SH script ?