Why does conda initialization require a sudo check?

I have Fedora 40 and I installed conda using the dnf package manager. Why does conda init require a sudo authorization? I have worked with conda (forge) on darwin where it does not require a sudo authorization for conda init

If someone could throw light on this matter, it will be great.

I would prefer to run conda without su privileges.

1 Like

This isn’t a Fedora specific issue from what I know. Using conda on Linux generally asks for sudo permissions. I assume it is because it wants to modify some system files—probably the bash completion scripts. I haven’t able to find any information in the coda docs, unfortunately but the sources suggest it tries to update system paths:

2 Likes

Added anaconda

Try conda init --dry-run.

% conda init --dry-run
modified      /usr/condabin/conda
modified      /usr/bin/conda
modified      /usr/bin/conda-env
modified      /usr/bin/activate
modified      /usr/bin/deactivate
modified      /usr/etc/profile.d/conda.sh
needs sudo    /usr/etc/fish/conf.d/conda.fish
modified      /usr/shell/condabin/Conda.psm1
modified      /usr/shell/condabin/conda-hook.ps1
needs sudo    /usr/lib/python3.12/site-packages/xontrib/conda.xsh
modified      /usr/etc/profile.d/conda.csh
modified      /home/gnw3/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

Operation failed.

I don’t use xontrib.
I use zsh. In ~/.zshrc I have (F40 and F41):

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/usr/etc/profile.d/conda.sh" ]; then
        . "/usr/etc/profile.d/conda.sh"
    else
        export PATH="/usr/bin:$PATH"
    fi
fi
unset __conda_setup
PS1="${CONDA_PROMPT_MODIFIER}[%n]%~%# "
# <<< conda initialize <<<
3 Likes