GNU bug report logs - #42920
conda 4.8.3 on guix cannot activate environments

Previous Next

Package: guix;

Reported by: Hugo Buddelmeijer <hugo <at> buddelmeijer.nl>

Date: Tue, 18 Aug 2020 19:25:02 UTC

Severity: normal

Full log


Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hugo Buddelmeijer <hugo <at> buddelmeijer.nl>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: bug-guix <at> gnu.org, 42920 <at> debbugs.gnu.org
Subject: Re: conda 4.8.3 on guix cannot activate environments
Date: Sun, 23 Aug 2020 21:26:39 +0200
[Message part 1 (text/plain, inline)]
Just sharing a bit of more info about why the conda prompt breaks.

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

>
> Hugo Buddelmeijer <hugo <at> 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":
https://superuser.com/questions/663069/why-does-subshell-not-inherit-exported-variable-ps1
https://tldp.org/HOWTO/Bash-Prompt-HOWTO/setps.html

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.

Hugo



> --
> Ricardo
>
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 74 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.