From unknown Sat Sep 13 02:52:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46569: python can't find internal pip modules in environment from manifest Resent-From: Jelle Licht Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 16 Feb 2021 20:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46569 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 46569@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161350911324087 (code B ref -1); Tue, 16 Feb 2021 20:59:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Feb 2021 20:58:33 +0000 Received: from localhost ([127.0.0.1]:41767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lC7QS-0006GK-4s for submit@debbugs.gnu.org; Tue, 16 Feb 2021 15:58:33 -0500 Received: from lists.gnu.org ([209.51.188.17]:47906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lC7QQ-0006GC-1H for submit@debbugs.gnu.org; Tue, 16 Feb 2021 15:58:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC7QP-000734-OZ for bug-guix@gnu.org; Tue, 16 Feb 2021 15:58:25 -0500 Received: from mail1.fsfe.org ([217.69.89.151]:56620) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC7QN-0000UB-QO for bug-guix@gnu.org; Tue, 16 Feb 2021 15:58:25 -0500 From: Jelle Licht Date: Tue, 16 Feb 2021 21:58:20 +0100 Message-ID: <86czwz7ms3.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.69.89.151; envelope-from=jlicht@fsfe.org; helo=mail1.fsfe.org X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Python can not load all pip-related python modules when loaded from a manifest file, yet seems to work fine when loaded 'directly' as part of a `guix environment'-invocation. Provided that we have a file in `hi.py': --8<---------------cut here---------------start------------->8--- import pip print("halfwaypoint") import pip._internal.index.package_finder print("I made it!") --8<---------------cut here---------------end--------------->8--- and a `manifest.scm' with: --8<---------------cut here---------------start------------->8--- (use-modules (gnu) (guix packages) (gnu packages python) (gnu packages python-xyz)) (packages->manifest (list python python-pip)) --8<---------------cut here---------------end--------------->8--- I can get the expected output by running: `guix environment --pure --ad-hoc python python-pip -- python3 hi.py' => > halfwaypoint > I made it! Yet, when I run the following: `guix environment --pure -m manifest.scm -- python3 hi.py' => --8<---------------cut here---------------start------------->8--- halfwaypoint Traceback (most recent call last): File "hi.py", line 4, in import pip._internal.index.package_finder File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/__init__.py", line 40, in from pip._internal.cli.autocompletion import autocomplete File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 8, in from pip._internal.cli.main_parser import create_main_parser File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 11, in from pip._internal.commands import ( File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 6, in from pip._internal.commands.completion import CompletionCommand File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/commands/completion.py", line 6, in from pip._internal.cli.base_command import Command File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 26, in from pip._internal.index import PackageFinder ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/index/__init__.py) --8<---------------cut here---------------end--------------->8--- Why is there a difference in the first place? Shouldn't both approaches work? - Jelle From unknown Sat Sep 13 02:52:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46569: python can't find internal pip modules in environment from manifest Resent-From: Jelle Licht Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 18 Feb 2021 13:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46569 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 46569@debbugs.gnu.org Received: via spool by 46569-submit@debbugs.gnu.org id=B46569.161365617726950 (code B ref 46569); Thu, 18 Feb 2021 13:50:01 +0000 Received: (at 46569) by debbugs.gnu.org; 18 Feb 2021 13:49:37 +0000 Received: from localhost ([127.0.0.1]:46426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCjgS-00070V-5f for submit@debbugs.gnu.org; Thu, 18 Feb 2021 08:49:37 -0500 Received: from mail1.fsfe.org ([217.69.89.151]:57068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCjgQ-00070O-N0 for 46569@debbugs.gnu.org; Thu, 18 Feb 2021 08:49:31 -0500 From: Jelle Licht In-Reply-To: <86czwz7ms3.fsf@fsfe.org> References: <86czwz7ms3.fsf@fsfe.org> Date: Thu, 18 Feb 2021 14:49:28 +0100 Message-ID: <86zh015vvb.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Jelle Licht writes: > Python can not load all pip-related python modules when loaded from a > manifest file, yet seems to work fine when loaded 'directly' as part of > a `guix environment'-invocation. > > > Provided that we have a file in `hi.py': > --8<---------------cut here---------------start------------->8--- > import pip > print("halfwaypoint") > import pip._internal.index.package_finder > print("I made it!") > --8<---------------cut here---------------end--------------->8--- > > and a `manifest.scm' with: > > --8<---------------cut here---------------start------------->8--- > (use-modules (gnu) (guix packages) > (gnu packages python) > (gnu packages python-xyz)) > > (packages->manifest (list python python-pip)) > --8<---------------cut here---------------end--------------->8--- > > I can get the expected output by running: > `guix environment --pure --ad-hoc python python-pip -- python3 hi.py' =3D> >> halfwaypoint >> I made it! > > Yet, when I run the following: > `guix environment --pure -m manifest.scm -- python3 hi.py' =3D> > > --8<---------------cut here---------------start------------->8--- > halfwaypoint > Traceback (most recent call last): > File "hi.py", line 4, in > import pip._internal.index.package_finder > File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8= /site-packages/pip/_internal/__init__.py", line 40, in > from pip._internal.cli.autocompletion import autocomplete > File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8= /site-packages/pip/_internal/cli/autocompletion.py", line 8, in > from pip._internal.cli.main_parser import create_main_parser > File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8= /site-packages/pip/_internal/cli/main_parser.py", line 11, in > from pip._internal.commands import ( > File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8= /site-packages/pip/_internal/commands/__init__.py", line 6, in > from pip._internal.commands.completion import CompletionCommand > File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8= /site-packages/pip/_internal/commands/completion.py", line 6, in > from pip._internal.cli.base_command import Command > File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8= /site-packages/pip/_internal/cli/base_command.py", line 26, in > from pip._internal.index import PackageFinder > ImportError: cannot import name 'PackageFinder' from 'pip._internal.index= ' (/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-p= ackages/pip/_internal/index/__init__.py) > --8<---------------cut here---------------end--------------->8--- > > Why is there a difference in the first place? Shouldn't both approaches w= ork? Using diffoscope, I found the (practical) difference: $GUIX_ENVIRONMENT/bin/pip3 is =E2=94=82 =E2=94=82 -destination: /gnu/store/rz42ba0my9vrgbkjpkzr2drmnjk5ah= 50-python-3.8.2/bin/pip3 =E2=94=82 =E2=94=82 +destination: /gnu/store/d75bwzbla5ybhs0mdw80qy94mawnhh= sw-python-pip-20.2.4/bin/pip3 If you make sure that `python-pip' precedes the `python' package in the manifest, things work out fine. Likewise for the following --ad-hoc example: This fails: guix environment --ad-hoc python-pip python -- python3 hi.py This works: guix environment --ad-hoc python python-pip -- python3 hi.py So it seems the order in which guix sees packages when building profiles determines how collisions are resolved, good to know :-). Is the python-included pip package supposed to be broken like this, though? - Jelle From unknown Sat Sep 13 02:52:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46569: python can't find internal pip modules in environment from manifest Resent-From: Jelle Licht Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 18 Feb 2021 16:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46569 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 46569@debbugs.gnu.org Received: via spool by 46569-submit@debbugs.gnu.org id=B46569.161366627211762 (code B ref 46569); Thu, 18 Feb 2021 16:38:02 +0000 Received: (at 46569) by debbugs.gnu.org; 18 Feb 2021 16:37:52 +0000 Received: from localhost ([127.0.0.1]:47828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCmJM-00033e-1F for submit@debbugs.gnu.org; Thu, 18 Feb 2021 11:37:52 -0500 Received: from mail1.fsfe.org ([217.69.89.151]:36868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCmJK-00033V-6c for 46569@debbugs.gnu.org; Thu, 18 Feb 2021 11:37:50 -0500 From: Jelle Licht In-Reply-To: <86zh015vvb.fsf@fsfe.org> References: <86czwz7ms3.fsf@fsfe.org> <86zh015vvb.fsf@fsfe.org> Date: Thu, 18 Feb 2021 17:37:48 +0100 Message-ID: <86o8gh5o2r.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Jelle Licht writes: > Jelle Licht writes: > This fails: > guix environment --ad-hoc python-pip python -- python3 hi.py > > This works: > guix environment --ad-hoc python python-pip -- python3 hi.py This should be the other way around, pasting error on my end. From unknown Sat Sep 13 02:52:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46569: python can't find internal pip modules in environment from manifest Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 18 Feb 2021 18:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46569 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Jelle Licht Cc: 46569@debbugs.gnu.org Received: via spool by 46569-submit@debbugs.gnu.org id=B46569.161367155620286 (code B ref 46569); Thu, 18 Feb 2021 18:06:01 +0000 Received: (at 46569) by debbugs.gnu.org; 18 Feb 2021 18:05:56 +0000 Received: from localhost ([127.0.0.1]:47925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCnga-0005H8-3E for submit@debbugs.gnu.org; Thu, 18 Feb 2021 13:05:56 -0500 Received: from mail-qk1-f180.google.com ([209.85.222.180]:46442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCngY-0005Gv-C7 for 46569@debbugs.gnu.org; Thu, 18 Feb 2021 13:05:54 -0500 Received: by mail-qk1-f180.google.com with SMTP id w19so2943244qki.13 for <46569@debbugs.gnu.org>; Thu, 18 Feb 2021 10:05:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=juTtzpgs6DvpUhYbFae9tCU3TPyO33QthWKUmEbM4Ts=; b=aKhHx99mPMXnNBZhTv+WSalFQxTmFJLeQMuUgSa0wD067hZxMWJh/HY8HOsuTIcPsr jHrrlcCjLMrxyjk6SX4eMqvAhBUUa+5NcAZzah/IqYEN7QZySkiTfhY/Y9/2PouCBxyI urYD6aj779IeHzKArXBf0dHJdo/9x6rv/INu71FlL7XoTf1lD0bBOVGNMDMdgOTaKDpo 02/tuBrpEqSDk9b+u5gE0R3iMoqvCHRsHX8wSm9aJMH4BNliyvv/Xcb7PaxoC/Hks30/ +42097NI2QbWrl1Yr7F20Thi+Olz58Ul6tAYxgYenkoS86UV1q60Zq7BmSgzhr+1Ubou ZUIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=juTtzpgs6DvpUhYbFae9tCU3TPyO33QthWKUmEbM4Ts=; b=TtuX9Au8nkepPVqMcO+KNR4tYRukvY2VWzgJ1WOFshzJ+81s94B2WAD6Xruhh31PPj jA8JOkc9Xr/YxbuNhodNXX5k3YahrG8K2oLmMVFvDUu1i90us7YeZYMNXiX/9WdLFNlt H7BVE6oECdT+QnSazMFgznfIGflHsv5PRuXK7hCKVhq8MSPc4eI5Rao2qHT7pnpEyJiv lWV2QUJiGd9DdaiM1ERdjZGdF0hO4WEV9JSRcv9riiY402j1LH63SxyKKA47/nqkI5AZ iHIN6XvH0f8MoFfgvdSjGrc3dLl4YWlKdPgGT6Bu35UjUdji8LvHz5Gq1QaJGupjPnfa AF4A== X-Gm-Message-State: AOAM530KOyeS64XGzz1Z1x05/71jvxyh/ncIbx6hV0v/UTWu8xlwjwAb YWFjyWKOeA8AO1n1nnhPJKd5b2fBddGFpA== X-Google-Smtp-Source: ABdhPJzV1FqO1hSw1BUUvY5DaHO2rAsKL3o2TZxWlQjuku6NIe3eApgHfU3WxD+L4Ny2Kg9IKlinYw== X-Received: by 2002:a37:a68a:: with SMTP id p132mr5467040qke.26.1613671548903; Thu, 18 Feb 2021 10:05:48 -0800 (PST) Received: from hurd (dsl-157-68.b2b2c.ca. [66.158.157.68]) by smtp.gmail.com with ESMTPSA id v5sm4458349qkg.47.2021.02.18.10.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 10:05:48 -0800 (PST) From: Maxim Cournoyer References: <86czwz7ms3.fsf@fsfe.org> Date: Thu, 18 Feb 2021 13:05:47 -0500 In-Reply-To: <86czwz7ms3.fsf@fsfe.org> (Jelle Licht's message of "Tue, 16 Feb 2021 21:58:20 +0100") Message-ID: <87sg5tuu84.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Jelle, Jelle Licht writes: > Python can not load all pip-related python modules when loaded from a > manifest file, yet seems to work fine when loaded 'directly' as part of > a `guix environment'-invocation. > > > Provided that we have a file in `hi.py': > > import pip > print("halfwaypoint") > import pip._internal.index.package_finder > print("I made it!") > > > and a `manifest.scm' with: > > (use-modules (gnu) (guix packages) > (gnu packages python) > (gnu packages python-xyz)) > > (packages->manifest (list python python-pip)) > > > I can get the expected output by running: > `guix environment --pure --ad-hoc python python-pip -- python3 hi.py' => >> halfwaypoint >> I made it! It seems that two pip versions don't cohabit very well. The same happens if you install pip via 'pip install --user pip' (e.g., to ~/.local/bin) and try to use it. You could try using the pip version that comes bundled with Python itself (e.g, not installing python-pip in the same profile); if it's the only one, it should work. HTH, Maxim From unknown Sat Sep 13 02:52:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46569: python can't find internal pip modules in environment from manifest Resent-From: Jelle Licht Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 18 Feb 2021 19:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46569 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Maxim Cournoyer Cc: 46569@debbugs.gnu.org Received: via spool by 46569-submit@debbugs.gnu.org id=B46569.16136775595107 (code B ref 46569); Thu, 18 Feb 2021 19:46:01 +0000 Received: (at 46569) by debbugs.gnu.org; 18 Feb 2021 19:45:59 +0000 Received: from localhost ([127.0.0.1]:48017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCpFP-0001KJ-MP for submit@debbugs.gnu.org; Thu, 18 Feb 2021 14:45:59 -0500 Received: from mail1.fsfe.org ([217.69.89.151]:45796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCpFO-0001KA-EQ for 46569@debbugs.gnu.org; Thu, 18 Feb 2021 14:45:59 -0500 From: Jelle Licht In-Reply-To: <87sg5tuu84.fsf@gmail.com> References: <86czwz7ms3.fsf@fsfe.org> <87sg5tuu84.fsf@gmail.com> Date: Thu, 18 Feb 2021 20:45:54 +0100 Message-ID: <86lfbl5fd9.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Maxim Cournoyer writes: > Hi Jelle, > > Jelle Licht writes: > >> Python can not load all pip-related python modules when loaded from a >> manifest file, yet seems to work fine when loaded 'directly' as part of >> a `guix environment'-invocation. >> >> >> Provided that we have a file in `hi.py': >> >> import pip >> print("halfwaypoint") >> import pip._internal.index.package_finder >> print("I made it!") >> >> >> and a `manifest.scm' with: >> >> (use-modules (gnu) (guix packages) >> (gnu packages python) >> (gnu packages python-xyz)) >> >> (packages->manifest (list python python-pip)) >> >> >> I can get the expected output by running: >> `guix environment --pure --ad-hoc python python-pip -- python3 hi.py' => >>> halfwaypoint >>> I made it! > > It seems that two pip versions don't cohabit very well. The same > happens if you install pip via 'pip install --user pip' (e.g., to > ~/.local/bin) and try to use it. > > You could try using the pip version that comes bundled with Python > itself (e.g, not installing python-pip in the same profile); if it's the > only one, it should work. It doesn't, though, with the exact same error message as above. Does my example (hi.py) work for you? From unknown Sat Sep 13 02:52:48 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jelle Licht Subject: bug#46569: closed (Re: bug#46569: python can't find internal pip modules in environment from manifest) Message-ID: References: <87h7m9ulag.fsf@gmail.com> <86czwz7ms3.fsf@fsfe.org> X-Gnu-PR-Message: they-closed 46569 X-Gnu-PR-Package: guix Reply-To: 46569@debbugs.gnu.org Date: Thu, 18 Feb 2021 21:19:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1613683142-30430-1" This is a multi-part message in MIME format... ------------=_1613683142-30430-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #46569: python can't find internal pip modules in environment from manifest which was filed against the guix package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 46569@debbugs.gnu.org. --=20 46569: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D46569 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1613683142-30430-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 46569-done) by debbugs.gnu.org; 18 Feb 2021 21:18:56 +0000 Received: from localhost ([127.0.0.1]:48264 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCqhM-0007uU-3C for submit@debbugs.gnu.org; Thu, 18 Feb 2021 16:18:56 -0500 Received: from mail-qt1-f179.google.com ([209.85.160.179]:45828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCqhJ-0007uG-U5 for 46569-done@debbugs.gnu.org; Thu, 18 Feb 2021 16:18:54 -0500 Received: by mail-qt1-f179.google.com with SMTP id o30so2164705qtd.12 for <46569-done@debbugs.gnu.org>; Thu, 18 Feb 2021 13:18:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=iZogSwKhcJuvCV+3OwvDJcGQB/1FMIn2YIINzR72q4c=; b=PR2cx35RE9TUSC7ZI7BqWtNfJXWZgt11PPgCc/ikXoaGF27bRpBW8oX0tHEzKjX1C1 tU+K2gTfqphlaLjjjjTogqi0AxrmsFwxb4j8bQO6aXZB4Hu1gIHdlPAVfNYfmyII+iFW qKxHSDqG8oDnWtEal+Yz9hX6JKpLEYNKaY9fzVEKmUP/CyV9nF+zspNesI02i0zUvBpz wCjQ5OTs2H5EOAfA78RSZKSEfgdFqeP00aP7IwwUOvq27OnKOnk2owklxE4Vvj59vK0R z+LeQUS/UTutHuLKwi1AkGgyKM6qzyQ9tTQLPAQjFLcvyGGvtEoZkBJBm3dX5bBm048F NKnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=iZogSwKhcJuvCV+3OwvDJcGQB/1FMIn2YIINzR72q4c=; b=EYavvPkKUu/vFS36Wv4tTUxbupKVosw/xH72zZJTku3q8Klwy54PelCvo2UzmtM+x1 AYFHr8Jv6/dvypWmWdegd/6zyo9wo0cf7gwFggewux0vN63t8uS9A+wSMkWmwGIPsxZP JoTHLKqivRNWRWfma2esMEKhtK370ZeAajYrlON7vGE5Bx+/QBbKUcrXAtNfh3p0A9Yi qo4d5U7tGV83cAoxtGfJqs2k5ZVQCqSnULSqw/gHkzYMGM14mdcBgr3FlNwIAl94mOXJ M/TwVRiZKJa9CWjcyOcnSG48/hPAxTlhG8pOHAEsIGmILsOWTCzVh3B10fjyNr7PuHyw hZYQ== X-Gm-Message-State: AOAM533gzgUG+nytVXxlKWqnkcTIhJd8Qx1Qz+pwwU7EbZIMOxtrHErt 02mm0+uATmZGn8t8rbREKBBIY8oHrKiBLA== X-Google-Smtp-Source: ABdhPJz/pb/tB+1daNKEvv1GvbXEsdZdDjDKHD9/Cp81mJGT0SbgRJJ6Gl5zj5KoKQBEtE9j70H0xQ== X-Received: by 2002:a05:622a:347:: with SMTP id r7mr5742284qtw.279.1613683128245; Thu, 18 Feb 2021 13:18:48 -0800 (PST) Received: from hurd (dsl-157-68.b2b2c.ca. [66.158.157.68]) by smtp.gmail.com with ESMTPSA id m5sm4890795qkf.55.2021.02.18.13.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 13:18:47 -0800 (PST) From: Maxim Cournoyer To: Jelle Licht Subject: Re: bug#46569: python can't find internal pip modules in environment from manifest References: <86czwz7ms3.fsf@fsfe.org> Date: Thu, 18 Feb 2021 16:18:47 -0500 In-Reply-To: <86czwz7ms3.fsf@fsfe.org> (Jelle Licht's message of "Tue, 16 Feb 2021 21:58:20 +0100") Message-ID: <87h7m9ulag.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46569-done Cc: 46569-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Jelle, Jelle Licht writes: > Python can not load all pip-related python modules when loaded from a > manifest file, yet seems to work fine when loaded 'directly' as part of > a `guix environment'-invocation. > > > Provided that we have a file in `hi.py': > > import pip > print("halfwaypoint") > import pip._internal.index.package_finder > print("I made it!") The problem seems to be related to the version of pip used. The one bundled with our Python on master is: $ guix environment --pure --ad-hoc python -- pip3 --version pip 19.2.3 from /gnu/store/pw65c67dmzr2m9wbkj5mskhm6ljk6xal-profile/lib/python3.8/site-packages/pip (python 3.8) and $ guix environment --pure --ad-hoc python -- python3 -c 'import pip._internal.index.package_finder' Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'pip._internal.index.package_finder'; 'pip._internal.index' is not a package but $ guix environment --pure --ad-hoc python python-pip -- pip3 --version pip 20.2.4 from /gnu/store/d75bwzbla5ybhs0mdw80qy94mawnhhsw-python-pip-20.2.4/lib/python3.8/site-packages/pip (python 3.8) and $ guix environment --pure --ad-hoc python python-pip -- python3 -c 'import pip._internal.index.package_finder' $ echo $? 0 HTH! Closing. Maxim ------------=_1613683142-30430-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 16 Feb 2021 20:58:33 +0000 Received: from localhost ([127.0.0.1]:41767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lC7QS-0006GK-4s for submit@debbugs.gnu.org; Tue, 16 Feb 2021 15:58:33 -0500 Received: from lists.gnu.org ([209.51.188.17]:47906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lC7QQ-0006GC-1H for submit@debbugs.gnu.org; Tue, 16 Feb 2021 15:58:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC7QP-000734-OZ for bug-guix@gnu.org; Tue, 16 Feb 2021 15:58:25 -0500 Received: from mail1.fsfe.org ([217.69.89.151]:56620) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC7QN-0000UB-QO for bug-guix@gnu.org; Tue, 16 Feb 2021 15:58:25 -0500 From: Jelle Licht To: bug-guix@gnu.org Subject: python can't find internal pip modules in environment from manifest Date: Tue, 16 Feb 2021 21:58:20 +0100 Message-ID: <86czwz7ms3.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.69.89.151; envelope-from=jlicht@fsfe.org; helo=mail1.fsfe.org X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Python can not load all pip-related python modules when loaded from a manifest file, yet seems to work fine when loaded 'directly' as part of a `guix environment'-invocation. Provided that we have a file in `hi.py': --8<---------------cut here---------------start------------->8--- import pip print("halfwaypoint") import pip._internal.index.package_finder print("I made it!") --8<---------------cut here---------------end--------------->8--- and a `manifest.scm' with: --8<---------------cut here---------------start------------->8--- (use-modules (gnu) (guix packages) (gnu packages python) (gnu packages python-xyz)) (packages->manifest (list python python-pip)) --8<---------------cut here---------------end--------------->8--- I can get the expected output by running: `guix environment --pure --ad-hoc python python-pip -- python3 hi.py' => > halfwaypoint > I made it! Yet, when I run the following: `guix environment --pure -m manifest.scm -- python3 hi.py' => --8<---------------cut here---------------start------------->8--- halfwaypoint Traceback (most recent call last): File "hi.py", line 4, in import pip._internal.index.package_finder File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/__init__.py", line 40, in from pip._internal.cli.autocompletion import autocomplete File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 8, in from pip._internal.cli.main_parser import create_main_parser File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 11, in from pip._internal.commands import ( File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 6, in from pip._internal.commands.completion import CompletionCommand File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/commands/completion.py", line 6, in from pip._internal.cli.base_command import Command File "/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 26, in from pip._internal.index import PackageFinder ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/gnu/store/4m5vhlq61qnj36rq60l83xcmgj3mx92j-profile/lib/python3.8/site-packages/pip/_internal/index/__init__.py) --8<---------------cut here---------------end--------------->8--- Why is there a difference in the first place? Shouldn't both approaches work? - Jelle ------------=_1613683142-30430-1--