From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KBJ7J1K1Pl/dCQAA0tVLHw (envelope-from ) for ; Thu, 20 Aug 2020 17:39:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id GOdpI1K1Pl/4ZQAA1q6Kng (envelope-from ) for ; Thu, 20 Aug 2020 17:39:30 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E78C49403A9 for ; Thu, 20 Aug 2020 17:39:29 +0000 (UTC) Received: from localhost ([::1]:35452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8oXA-0001sC-Qs for larch@yhetil.org; Thu, 20 Aug 2020 13:39:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8oWl-0001Cr-3Q for bug-guix@gnu.org; Thu, 20 Aug 2020 13:39:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8oWk-0002tV-Px for bug-guix@gnu.org; Thu, 20 Aug 2020 13:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k8oWk-0004HQ-Na for bug-guix@gnu.org; Thu, 20 Aug 2020 13:39:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#42920: conda 4.8.3 on guix cannot activate environments Resent-From: Hugo Buddelmeijer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 20 Aug 2020 17:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42920 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ricardo Wurmus X-Debbugs-Original-Cc: bug-guix@gnu.org, 42920@debbugs.gnu.org Received: via spool by 42920-submit@debbugs.gnu.org id=B42920.159794513516405 (code B ref 42920); Thu, 20 Aug 2020 17:39:02 +0000 Received: (at 42920) by debbugs.gnu.org; 20 Aug 2020 17:38:55 +0000 Received: from localhost ([127.0.0.1]:43880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k8oWc-0004GR-PF for submit@debbugs.gnu.org; Thu, 20 Aug 2020 13:38:55 -0400 Received: from mail-pl1-f176.google.com ([209.85.214.176]:45593) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k8nb0-0006j2-Kn for 42920@debbugs.gnu.org; Thu, 20 Aug 2020 12:39:23 -0400 Received: by mail-pl1-f176.google.com with SMTP id bh1so1175331plb.12 for <42920@debbugs.gnu.org>; Thu, 20 Aug 2020 09:39:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L1Q2RCOmFFFesk3NijohkvIjX+5gM7TyWvbOqMEmNCo=; b=fZtW8AyKBJQ6t7uKR10I6DLruTJn3JoI/KpESOp6FnZ6NSBgSdJ76oU68CYDoZkoHF EExC5dTvsHSL6LdHpvmZ83bjs+uceGmhslbFqnj5+07n5Gl7r5vDDVs/pEfc12NC9FU0 r+Md2lZyon5rG8A+HnuArrwQ/QBixlmU9Ka5Y+4YYv4H8ZUzsb+x9ta/OtMhhr87X8K6 /GfY2Rg1q1blOPv7MLT0snFS9TUSnDR8Jf1/tWthtWYN2UJqCSOTQL+US2uDRB1FKFtF rerHyyP50aALqXtcYJOhf9zqDLXOW1lPjXr3u4M/e3V/8wsMRmsZyl74Zsj0Fgd5Brrm 9uHQ== X-Gm-Message-State: AOAM530Y4eQGTvBkDVZoY7FYYieIYJDEmnb5zgV/gravDOA8DMCBxXTk hrv76Kz0sp6X3l+9dpm3WsFgFntxLfoHrFZUNGusrEsSl180tg== X-Google-Smtp-Source: ABdhPJxzylV1GUCLTPUiMyW3hOeMt2lDCOAylRD+RnaRCxr7vT+qWSXNzr8fO9bvsAzCZS58gHGqlnvO7dHdC79eoyQ= X-Received: by 2002:a17:90a:fb4b:: with SMTP id iq11mr3152803pjb.127.1597941556452; Thu, 20 Aug 2020 09:39:16 -0700 (PDT) MIME-Version: 1.0 References: <87blj7x841.fsf@elephly.net> In-Reply-To: <87blj7x841.fsf@elephly.net> From: Hugo Buddelmeijer Date: Thu, 20 Aug 2020 18:39:05 +0200 Message-ID: Content-Type: multipart/alternative; boundary="000000000000d823d105ad51c234" X-Spam-Score: 0.5 (/) X-Mailman-Approved-At: Thu, 20 Aug 2020 13:38:52 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -0.5 (/) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 42920@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -0.01 X-TUID: hlvj5nt8ueDR --000000000000d823d105ad51c234 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Ricardo, On Wed, 19 Aug 2020 at 12:07, Ricardo Wurmus wrote: > > > The conda 4.8.3 package on guix does not seem to work as expected. > > Thanks for letting me know. The upgrade took a long time and required > quite a bit of patching. > Thanks for doing this hard work! It is much appreciated, I don't think I would have started experimenting with guix without your head start. > > But activating it does not work properly: > > > > hugo@alex ~$ conda activate testenv > > > > CommandNotFoundError: Your shell has not been properly configured to us= e > > 'conda activate'. > > To initialize your shell, run > > > > $ conda init > > This is very unfortunate, but perhaps we can work around this. > Initially I noticed that almost none of the Conda features worked > without =E2=80=9Cconda init=E2=80=9D, so I decided to run =E2=80=9Cconda = init=E2=80=9D as part of the > build. This installs a whole bunch of shell initialization files into > the prefix directory, which =E2=80=94 I assume =E2=80=94 are meant to be = evaluated when > the shell starts. > > So I suspect that you can get around this by manually sourcing the > appropriate shell init files. Which of these need to be sourced > probably depends on your current shell. > That indeed kinda works. `conda init bash` adds this to `.bashrc` (apparently before asking for the sudo password): # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup=3D"$('/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3= /bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/etc/profile.d/cond= a.sh" ]; then . "/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/etc/profile.d/cond= a.sh" else export PATH=3D"/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<< And running this will indeed allow an environment to be activated. The `testenv3` environment contains only Python: hugo@alex ~$ which python which: no python in (/run/setuid-programs:/home/hugo/.config/guix/current/bin:/home/hugo/.guix-= profile/bin:/run/current-system/profile/bin:/run/current-system/profile/sbi= n) hugo@alex ~$ source .bashrc (base) conda activate testenv3 (testenv3) (testenv3) which python /home/hugo/.conda/envs/testenv3/bin/python (testenv3) python -bash: /home/hugo/.conda/envs/testenv3/bin/python: No such file or director= y (testenv3) readelf --all $(which python) | grep interpreter [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] So there are three problems: 1. The PATHS in .bashrc should be to ~/.guix-profile/etc/profile.d/, not to /gnu/store directly. This is trivial to fix manually. 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. 3. The installed software does not have the proper interpreter set. This can probably be fixed with patchelf, but now I'm wondering whether this is the right approach, because that would be necessary for all packages installed through conda. (Or is there a way to do that automatically? Apparently just symlinking ld-linux-x86.so.2 into (from?) /lib64 also works, but that feels like a very un-guixy hack.) Sidenote, FWIW, there are also some problems with some of the scripts installed in /gnu/store: hugo@alex ~$ /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/condabin/conda -bash: /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/condabin/conda: /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/python: bad interpreter: No such file or directory hugo@alex ~$ /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/activate /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/activate: line 3: /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/.activate-real: Permission denied /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/activate: line 3: exec: /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/.activate-real: cannot execute: Permission denied It seems not necessary to actually use these scripts though. Ultimately it would be nice if all conda packages would be available in guix directly (as guix packages, removing the need for conda), but that is going to take a while. The above workarounds are probably sufficient to get something going until then. Once we settle on a good way to approach this, where should we document this? As in, if we want users to ignore the complaints from conda and instead put something in their .bashrc manually, then that information should be discoverable somehow. > FWIW, maybe it would be simpler to create a micromamba package than a > conda > > package: > > https://github.com/TheSnakePit/mamba > > Why not both? > Maybe I'll give it a shot. (micro)mamba is still a bit unstable it seems, but it might be a good fit for guix. Cheers, Hugo --000000000000d823d105ad51c234 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Ricardo,

<= div dir=3D"ltr" class=3D"gmail_attr">On Wed, 19 Aug 2020 at 12:07, Ricardo = Wurmus <rekado@elephly.net>= wrote:

> The conda 4.8.3 package on guix does not seem to work as expected.

Thanks for letting me know.=C2=A0 The upgrade took a long time and required=
quite a bit of patching.

Thanks for doi= ng this hard work! It is much appreciated, I don't think I would have s= tarted experimenting with guix without your head start.
=C2= =A0
> But activating it does not work properly:
>
> hugo@alex ~$ conda activate testenv
>
> CommandNotFoundError: Your shell has not been properly configured to u= se
> 'conda activate'.
> To initialize your shell, run
>
>=C2=A0 =C2=A0 =C2=A0$ conda init <SHELL_NAME>

This is very unfortunate, but perhaps we can work around this.
Initially I noticed that almost none of the Conda features worked
without =E2=80=9Cconda init=E2=80=9D, so I decided to run =E2=80=9Cconda in= it=E2=80=9D as part of the
build.=C2=A0 This installs a whole bunch of shell initialization files into=
the prefix directory, which =E2=80=94 I assume =E2=80=94 are meant to be ev= aluated when
the shell starts.

So I suspect that you can get around this by manually sourcing the
appropriate shell init files.=C2=A0 Which of these need to be sourced
probably depends on your current shell.

That indeed kinda works. `conda init bash` adds this to `.bashrc` (apparen= tly before asking for the sudo password):

# >&g= t;> conda initialize >>>
# !! Contents within this block are= managed by 'conda init' !!
__conda_setup=3D"$('/gnu/st= ore/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/conda' 'shell.= bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then=C2=A0 =C2=A0 eval "$__conda_setup"
else
=C2=A0 =C2=A0 if = [ -f "/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/etc/prof= ile.d/conda.sh" ]; then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 . "/gnu/st= ore/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/etc/profile.d/conda.sh&quo= t;
=C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 export PATH=3D"= ;/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin:$PATH"=C2=A0 =C2=A0 fi
fi
unset __conda_setup
# <<< conda init= ialize <<<

And running this will inde= ed allow an environment to be activated. The `testenv3` environment contain= s only Python:

hugo@alex ~$ which python
which:= no python in (/run/setuid-programs:/home/hugo/.config/guix/current/bin:/ho= me/hugo/.guix-profile/bin:/run/current-system/profile/bin:/run/current-syst= em/profile/sbin)
hugo@alex ~$ source .bashrc
(base) conda activate te= stenv3
(testenv3)
(testenv3) which python
/home/hugo/.conda/envs/= testenv3/bin/python
(testenv3) python
-bash: /home/hugo/.conda/envs/t= estenv3/bin/python: No such file or directory
(testenv3) read= elf --all $(which python) | grep interpreter
=C2=A0 =C2=A0 =C2=A0 [Reque= sting program interpreter: /lib64/ld-linux-x86-64.so.2]

<= /div>
So there are three problems:

1. The= PATHS in .bashrc should be to ~/.guix-profile/etc/profile.d/, not to /gnu/= store directly. This is trivial to fix manually.

2. The prompt is not set correctly, as in, what should happen is t= hat the current conda environment is added to the prompt. Instead, the prom= pt is replaced entirely by the environment. This shouldn't be too hard = to fix manually though.

3. The installed softw= are does not have the proper interpreter set. This can probably be fixed wi= th patchelf, but now I'm wondering whether this is the right approach, = because that would be necessary for all packages installed through conda. (= Or is there a way to do that automatically? Apparently just symlinking ld-l= inux-x86.so.2 into (from?) /lib64 also works, but that feels like a very un= -guixy hack.)

Sidenote, FWIW, there are a= lso some problems with some of the scripts installed in /gnu/store:

hugo@alex ~$ /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda= -4.8.3/condabin/conda
-bash: /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx= -conda-4.8.3/condabin/conda: /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-co= nda-4.8.3/bin/python: bad interpreter: No such file or directory
hu= go@alex ~$ /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/acti= vate
/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/activa= te: line 3: /gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518wmx-conda-4.8.3/bin/.ac= tivate-real: Permission denied
/gnu/store/ihn8dbs84rmc3ai7r1vkvh4cya518w= mx-conda-4.8.3/bin/activate: line 3: exec: /gnu/store/ihn8dbs84rmc3ai7r1vkv= h4cya518wmx-conda-4.8.3/bin/.activate-real: cannot execute: Permission deni= ed

It seems not necessary to actually us= e these scripts though.

Ultimately it would b= e nice if all conda packages would be available in guix directly (as guix p= ackages, removing the need for conda), but that is going to take a while. T= he above workarounds are probably sufficient to get something going until t= hen.

Once we settle on a good way to approach = this, where should we document this? As in, if we want users to ignore the = complaints from conda and instead put something in their .bashrc manually, = then that information should be discoverable somehow.

<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex"> > FWIW, maybe it would be simpler to create a micromamba package than a = conda
> package:
> https://github.com/TheSnakePit/mamba

Why not both?

Maybe I'll give it a = shot. (micro)mamba is still a bit unstable it seems, but it might be a good= fit for guix.

Cheers,
Hugo

--000000000000d823d105ad51c234--