Just sharing a bit of more info about why the conda prompt breaks.
Hugo Buddelmeijer <hugo@buddelmeijer.nl> writes:
> 2. The prompt is not set correctly, as in, what should happen is that the
> current conda environment is added to the prompt. Instead, the prompt is
> replaced entirely by the environment. This shouldn't be too hard to fix
> manually though.
Weird! Is this something Conda does wrong because it assumes too much
about the existing prompt?
This is what happens, reducing the files to the essence:
1) .bashrc runs
__conda_setup="$('/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
eval "$__conda_setup"
2) __conda_setup runs
__conda_activate() {
ask_conda="$(PS1="$PS1" "$CONDA_EXE" $_CE_M $_CE_CONDA shell.posix "$cmd" "$@")" || \return $?
\eval "$ask_conda"
}
conda activate base
3) ask_conda will contain the new PS1 definition. The command ran to create ask_conda is
PS1="\u@\h \w\$" "/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/conda" shell.posix "activate" "base"
4) conda runs
#!/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash
export PYTHONPATH="/gnu/store....."
exec -a "$0" "/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/.conda-real" "$@"
5) .conda.real generates the prompt in Python:
from conda.cli import main
sys.exit(main())
6) .conda.real outputs
PS1='(base) '
export PATH='...
The problem with the prompt arises from step 4), because 'conda' has bash as interpreter, and "non-interactive bashes go out of their way to unset PS1":
So .conda.real never gets the PS1 variable and it disappears.
I don't really understand why there is a bash function, a conda bash script and a .conda-real python script.