Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

conda init doesn't initialize shell?

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
like image 402
Linus Avatar asked Oct 29 '25 02:10

Linus


1 Answers

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.

like image 162
merv Avatar answered Oct 31 '25 12:10

merv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!