Conda activate from bash scripts
how to launch bash scripts with an effective conda environment: conda activate, ...
- Can't execute conda activate from bash script
- source ~/your_conda/etc/profile.d/conda.sh
- Example to run my blogging environment
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.
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
#!/bin/bash
source ~/miniconda3/etc/profile.d/conda.sh
cd ~/git/guillaume/guillaume_blog/_notebooks
conda activate fastai
jupyter notebook