[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#42920: conda 4.8.3 on guix cannot activate environments

From: Hugo Buddelmeijer
Subject: bug#42920: conda 4.8.3 on guix cannot activate environments
Date: Sun, 23 Aug 2020 21:26:39 +0200

Just sharing a bit of more info about why the conda prompt breaks.

On Fri, 21 Aug 2020 at 05:52, Ricardo Wurmus <rekado@elephly.net> wrote:

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

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

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.

My local miniconda 4.8.3 installation on an Ubuntu machine (in my home directory) does not have a ".conda-real": "conda" directly is the Python script, so everything works.
Maybe more later.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]