Can’t execute conda activate
from bash script
Good description of the problem in conda github.
Calling conda activate
from a bash script will raise some 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
See 'conda init --help' for more information and options.
source ~/your_conda/etc/profile.d/conda.sh
It is just a matter of sourcing the conda bash settings before calling conda activate.
In m case I have installed conda in ~/miniconda3
, I just have to call source ~/miniconda3/etc/profile.d/conda.sh
Example to run my blogging environment
#!/bin/bash
source ~/miniconda3/etc/profile.d/conda.sh
cd ~/git/guillaume/guillaume_blog/_notebooks
conda activate fastai
jupyter notebook