Open ChrisMoriarty opened 1 month ago
I found a workaround for now: edit the conda.sh
file that gets places in /etc/profile.d
folder. I set the PS1 variable before the conda block:
PS1="[\u@\h \W]\$ ";
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/miniforge3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/miniforge3/etc/profile.d/conda.sh" ]; then
. "/opt/miniforge3/etc/profile.d/conda.sh"
else
export PATH="/opt/miniforge3/bin:$PATH"
fi
fi
unset __conda_setup
if [ -f "/opt/miniforge3/etc/profile.d/mamba.sh" ]; then
. "/opt/miniforge3/etc/profile.d/mamba.sh"
fi
# <<< conda initialize <<<
@ChrisMoriarty,
There's a setting you can use for this: changeps1
. Just set this to false
in your .condarc
file and it should not change the prompt.
More information here:
https://docs.conda.io/projects/conda/en/stable/configuration.html
Thanks @travishathaway, but as I noted in the Additional Context section, changeps1 does fix the prompt but I lose the environment prefix. I'm still using the fix I posted above, which initializes the PS1 variable before the "# >>> conda initialize >>>" section.
Checklist
What happened?
I am attempting to install miniconda system wide, for all users. According to the documentation, there is an argument
--system
that you can pass into theconda init
command to initialize conda for all users.This runs and works successfully, although it seemingly alters the PS1 prompt:
Before:
[root@server1 ~]#
After:
(base) -bash-5.1#
I'd like to preserve the [user@hostname folder] even after conda is initialized. This was all only tested in bash.
Conda Info
Conda Config
Conda list
Additional Context
I found that by adding
changeps1: False
to the .condarc file I'm able to restore the prompt to the system default, although I then lose the environment prefix (ex(base)
).Overall, I'm aiming to get the prompt to look like this:
(base) [root@server1 ~]#