unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Hugo Buddelmeijer <hugo@buddelmeijer.nl>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: 42920@debbugs.gnu.org
Subject: bug#42920: conda 4.8.3 on guix cannot activate environments
Date: Sun, 23 Aug 2020 21:26:39 +0200	[thread overview]
Message-ID: <CA+Jv8O1NFPMZ+bcDNmzLhNq_KGjqsR67g_c-EOHEpfg47f070A@mail.gmail.com> (raw)
In-Reply-To: <87364gy7tw.fsf@elephly.net>

[-- Attachment #1: Type: text/plain, Size: 2225 bytes --]

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

#!/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
>

[-- Attachment #2: Type: text/html, Size: 3803 bytes --]

  reply	other threads:[~2020-08-23 19:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 19:08 bug#42920: conda 4.8.3 on guix cannot activate environments Hugo Buddelmeijer
2020-08-19 10:06 ` Ricardo Wurmus
2020-08-20 16:39   ` Hugo Buddelmeijer
2020-08-21  3:51     ` Ricardo Wurmus
2020-08-23 19:26       ` Hugo Buddelmeijer [this message]
2020-08-25 12:34         ` Ricardo Wurmus
2020-08-25 15:03           ` Hugo Buddelmeijer
2021-03-01 18:50             ` Hugo Buddelmeijer
2021-08-18 10:07 ` Ricardo Wurmus
2022-04-05 10:40   ` zimoun
2022-04-05 13:26     ` Ricardo Wurmus
2022-04-05 14:50       ` Dominic Martinez
2022-04-05 15:19         ` Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+Jv8O1NFPMZ+bcDNmzLhNq_KGjqsR67g_c-EOHEpfg47f070A@mail.gmail.com \
    --to=hugo@buddelmeijer.nl \
    --cc=42920@debbugs.gnu.org \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).