Reputation: 187
I'm trying to activate a conda environment on a cluster. However, I keep being returned with the shell needing to be initialized. Ruuning conda init bash
does nothing and even when closing the shell and trying again I get the same 'conda is not initialized'?
-bash-4.2$ conda activate libraries/
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.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
-bash-4.2$ conda init bash
no change /usr/local/miniconda3/condabin/conda
no change /usr/local/miniconda3/bin/conda
no change /usr/local/miniconda3/bin/conda-env
no change /usr/local/miniconda3/bin/activate
no change /usr/local/miniconda3/bin/deactivate
no change /usr/local/miniconda3/etc/profile.d/conda.sh
no change /usr/local/miniconda3/etc/fish/conf.d/conda.fish
no change /usr/local/miniconda3/shell/condabin/Conda.psm1
no change /usr/local/miniconda3/shell/condabin/conda-hook.ps1
no change /usr/local/miniconda3/lib/python3.8/site-packages/xontrib/conda.xsh
no change /usr/local/miniconda3/etc/profile.d/conda.csh
no change /nethome/6966225/.bashrc
No action taken.
-bash-4.2$ conda activate libraries/
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
Upvotes: 4
Views: 16594
Reputation: 76950
The lack of changes is likely because you previously already ran conda init
and the changes have been made already - that is, Conda will only show this if it finds the initialization code is present. Have a look at your ~/.bashrc
file to check if there is a Conda initialization section.
The conda init
command only updates the shell initialization files (e.g., .bashrc
) to include shell function setup. One still needs to source the relevant initialization file. Typically, this is done by restarting the shell session or running . ~/.bashrc
.
Be aware that the shell also needs to be launched in a way that it loads the relevant initialization file. Most user-initiated shell sessions do this automatically, but in some situations one may need to explicitly include a flag for interactive (-i
in bash) or login (-l
in bash) sessions to ensure loading of .bashrc
or .bash_profile
files.
Upvotes: 5