Conda environment not shown in terminal

100 Views Asked by At

I have started to work with conda environments. They seem to work, but I have not managed to be visible on my Zsh terminal. All the tutorials I see have the conda environment at the start of the line (as in (conda-environment) $user) But that does not work for me. I have tried following a few tutorials to solve this problem, but it does not solve it.

First, this is my .condarc file (I have tried both 'True' and 'False' values here):

conda config --set changeps1 Truechannels:
 - conda-forge
 changeps1: False

Second, this is my zshrc file

 # Path to your oh-my-zsh installation.
 export ZSH="/Users/MYUSER/.oh-my-zsh"
 

 ZSH_THEME="pygmalion"
 
 plugins=(git)
 
 source $ZSH/oh-my-zsh.sh
 
 
 export PYENV_ROOT="$HOME/.pyenv"
 export PATH="$PYENV_ROOT/bin:$PATH"
 if command -v pyenv 1>/dev/null 2>&1; then
   eval "$(pyenv init -)"
 fi
 eval "$(pyenv init --path)"
 
 # magickWand
 export MAGICK_HOME="/opt/homebrew/"
 
 
 # >>> conda initialize >>>
 # !! Contents within this block are managed by 'conda init' !!
 __conda_setup="$('/Users/MYUSER/miniforge3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
 if [ $? -eq 0 ]; then
     eval "$__conda_setup"
 else
     if [ -f "/Users/MYUSER/miniforge3/etc/profile.d/conda.sh" ]; then
         . "/Users/MYUSER/miniforge3/etc/profile.d/conda.sh"
     else
         export PATH="/Users/MYUSER/miniforge3/bin:$PATH"
     fi
 fi
 unset __conda_setup
 
 if [ -f "/Users/MYUSER/miniforge3/etc/profile.d/mamba.sh" ]; then
     . "/Users/MYUSER/miniforge3/etc/profile.d/mamba.sh"
 fi
 # <<< conda initialize <<<
 
 # Show conda env
 #
 # Determines prompt modifier if and when a conda environment is active
 precmd_conda_info() {
   if [[ -n $CONDA_PREFIX ]]; then
       if [[ $(basename $CONDA_PREFIX) == "anaconda3" ]]; then
         # Without this, it would display conda version. Change to miniconda3 if necessary
         CONDA_ENV="(base) "
       else
         # For all environments that aren't (base)
         CONDA_ENV="($(basename $CONDA_PREFIX)) "
       fi
   # When no conda environment is active, don't show anything
   else
     CONDA_ENV=""
   fi
 }
 precmd_functions+=(precmd_conda_info)
 
 PROMPT='${COLOR_CON}$CONDA_ENV${COLOR_USR}%n ${COLOR_DIR}%1~ ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF}$ '
 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda ...ENVS):
0

There are 0 best solutions below