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: Tue, 25 Aug 2020 17:03:26 +0200 [thread overview]
Message-ID: <CA+Jv8O1uj5XrWk6PnO4UCwjBPxmfV+4QM_+uosP71POG6vkyTg@mail.gmail.com> (raw)
In-Reply-To: <87imd6x5to.fsf@elephly.net>
[-- Attachment #1: Type: text/plain, Size: 2428 bytes --]
Hi Ricardo,
On Tue, 25 Aug 2020 at 14:35, Ricardo Wurmus <rekado@elephly.net> wrote:
>
> > 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
>
> Good sleuthing!
>
> > So .conda.real never gets the PS1 variable and it disappears.
I did some more experiments, and forcing the wrapper script to start in
interactive mode solves the problem.
`conda init` adds some things to `.bashrc`, in particular it `eval`s the
output from `conda shell.bash hook`, which creates the `conda` bash
function (and associated functions).
The output from `conda shell.bash hook` seems to be based on
`/etc/profile.d/conda.sh`:
https://github.com/conda/conda/blob/master/conda/shell/etc/profile.d/conda.sh
As in, it prefixes some environment variables and appends the activation of
the base environment.
Now if we replace all 5 occurances of
"$CONDA_EXE" $_CE_M $_CE_CONDA
in that file with
bash --norc -i "$CONDA_EXE" $_CE_M $_CE_CONDA
then everything works as expected.
The -i is to enable interactive mode, preventing PS1 from being eaten.
--norc is necessary to not source .bashrc.
There are two occurences of "$CONDA_EXE" that should not be replaced, hence
adding the CE variables.
Would editing files like that be possible in a guix package script?
It seems that it is only a simple sed replace on a single file. It is a bit
hackish, because it adds knowledge to the package that a) there is a
wrapper script and b) it is in bash.
I have only experimented with it by copying the output off `conda
shell.bash hook` to a file in my home directory and editing that. Maybe I
can try to update the package too.
Other options:
- Use some other sh than bash, one that does not eat PS1, (e.g. dash) as
wrapper script. I just verified that *all* wrappers on my machine are bash.
However, some are using bash-minimal, so that means that there is a choice,
so maybe switching shells is possible?
- Somehow let conda work with another variable than PS1. Seems more
complicated.
Then what is left is updating `conda init` such that
- it doesn't complain when it cannot edit files
- it only uses paths in ~/.guix-profile
but this is not essential to get conda to work.
Cheers,
Hugo
[-- Attachment #2: Type: text/html, Size: 3549 bytes --]
next prev parent reply other threads:[~2020-08-25 15:04 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
2020-08-25 12:34 ` Ricardo Wurmus
2020-08-25 15:03 ` Hugo Buddelmeijer [this message]
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+Jv8O1uj5XrWk6PnO4UCwjBPxmfV+4QM_+uosP71POG6vkyTg@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).