From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id QA1hGjEPoGSQAwEASxT56A (envelope-from ) for ; Sat, 01 Jul 2023 13:34:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id EIV+GTEPoGThQAEAG6o9tA (envelope-from ) for ; Sat, 01 Jul 2023 13:34:09 +0200 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 CDA771D06F for ; Sat, 1 Jul 2023 13:34:08 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=koszko.org header.s=mail header.b=u6Piahd6; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688211249; a=rsa-sha256; cv=none; b=R6vt6yDfLBRbq9bqNdRVb1LCPjrPRHp/b9XwCheTniOeMlcOe1ZzbWlO/r+4/r3zxxuU4E gQ0BcQiuBXM6IS3iT+iU1yENpukI7/duyrjhTCDDF7q5WqEIWPksqckp8VMdydvJ9u/Psv f2jev13tg2Mc6+tv1NTyQf/R9EUqCPXWP9dyZXn3U36trtZ7+gMHeuJh59NdwfA7tECacx zPIEB8tT8qqN7QZ0Io2LoLILMQ9pQ27I6iMjvjbRwydOySDpR9ZCsN5LKo9AafzodFfN/F pYDWwLSMAbfNDGVkB3iv4IIfFGoO8PfT+cQNgM6m1kOQVhpCL9Rk9Sx7iKwZpw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=koszko.org header.s=mail header.b=u6Piahd6; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688211249; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=l1bphw8svxXTMMlMHINACsOynZlPdm2/mgoXCThel6M=; b=BBGoK8xQvfdZXgcDjwOqtHAlYZNVhQRF7j4vXTn+BvB6sSj31gAyKb9YFykqbed6e8/0U3 GDF8EuWJx364itKXZEGzJTIJlZfRS875Iq2RNEqkPmXNJO8AsSkSeSYXrU5erp8bpFEjog aO9TExKolUgWwJsPRjG3zsaKbC13NjRL6mu8GPdCMk4AhxOk/y/l0hq1W0xMA9stOuw93l XDxtyceZ5F1XLmDjp7JJtROAFk1TiB49EhLZhoZyNxnd7OfxZhG34Ivr0jJxL6KUTjWYgd yriEloJ3MEHhAqFPnuiCeHQ9H3N2NP4Pyfa6Pe5qvb5yAHsgG9M5SjIkcaB7fA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFYr1-0005hQ-BI; Sat, 01 Jul 2023 07:33:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFYqy-0005hC-65 for guix-devel@gnu.org; Sat, 01 Jul 2023 07:33:24 -0400 Received: from koszko.org ([93.95.227.159]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFYqv-00017j-CD for guix-devel@gnu.org; Sat, 01 Jul 2023 07:33:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=koszko.org; s=mail; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=l1bphw8svxXTMMlMHINACsOynZlPdm2/mgoXCThel6M=; b=u6Piahd6VWS8Yuy7Rw8eAIggen fo0eAxn4ywslpBArD5x0HrhAQCd5pzBBcqGjZI7LqKND6+YdCTxEBUHTNLwIIeIc2np0tH8dBABa0 gMP0ndXVF4HM71oYNmgOO+0bKMXBbU3poF33mxfTI6gSvMCZhbdV+BmslWQoIHg752KSbOlblhALN Mj7DaaDoK315n2uDVEJfmxU8PkwWOj0Bo8xVEdBgVlSCNsYQVVQa3X7kARcNPzxc+7wVYQJATOWIU HBadW3B8rXBdA8vtEbHyfVBjbQaTuhAk7GxDFhDyfXMysOEufC2P2XfYAS/B+1Q5VVa2WcL3TTYNf FlJv3HIPGtxFzagisXyg/14akHUG+5x3j/Ybpr8YnEbRvLgQ0E+0EhqBfyyUJwAQcinwwGsYWjpf9 wpLZZLaroLW4+F+WN3J72h9hWvnC0x1CD0GV3TGgmVy+E4xuojrFClDLDfttsLQIvgYsR/agpgBK4 kqQMzN0+Md8M1qgL3bPUXVLjFNhWHSedhf6ZTEhagVcRlNGJxKfdzOaduN0hgHru+XSguAZEeGoJe pyJ71Fh7x+fKmNYyBDd1zadL5GfsMo9ec2IH4HmUj/9+Q21gK7w1/EaXW3ed8KL27743CnoF1vYvD u+vj6ukxskTSsij66pkhDP5/tvF/566TAND02787g=; Received: from 77-252-46-118.static.ip.netia.com.pl ([77.252.46.118] helo=localhost) by koszko.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFYqa-0007cg-BV; Sat, 01 Jul 2023 13:33:00 +0200 Date: Sat, 1 Jul 2023 13:32:57 +0200 To: Maxim Cournoyer Cc: =?UTF-8?B?5a6L5paH5q2m?= , edk@beaver-labs.com, guix-devel Subject: Re: Guix's python has pip's user dir in its loadpath Message-ID: <20230701133257.6ada1e94.koszko@koszko.org> In-Reply-To: <87edls1fyk.fsf@gmail.com> References: <87edmey1wg.fsf@rdklein.fr> <877crma7qe.fsf@envs.net> <87edls1fyk.fsf@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/OKl/ez1mlXfdiFsnwwpREIr"; protocol="application/pgp-signature"; micalg=pgp-sha256 Received-SPF: pass client-ip=93.95.227.159; envelope-from=koszko@koszko.org; helo=koszko.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Wojtek Kosior From: Wojtek Kosior via "Development of GNU Guix and the GNU System distribution." Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -2.66 X-Migadu-Queue-Id: CDA771D06F X-Spam-Score: -2.66 X-TUID: wnaK2rn0wB8D --Sig_/OKl/ez1mlXfdiFsnwwpREIr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The precedence of local, pip-installed Python libraries over Guix ones has already been a source of bugs. And these can be hard to diagnose. I imagine an optimal solution would be to configure this behavior on per-package basis. The vast majority of applications does not need to load local libraries. There are just a few exceptions like `python-virtualenv`. Once I did write a package definition that deliberately disabled user site dir package loading. I used code similar to what's below. > (modify-phases %standard-phases > (add-after 'wrap 'prevent-local-package-interference > (lambda* (#:key outputs #:allow-other-keys) > (substitute* (string-append (assoc-ref outputs "out") > "/bin/") > (("^#!/.*$" shabang) > (string-append shabang > "export PYTHONNOUSERSITE=3D1\n")))))) Of course, it makes no sense to add such snippet to all definitions. Instead, we could modify python-build-system to allow doing a similar thing based on a flag passed in package's `(arguments)`. Wojtek -- (sig_start) website: https://koszko.org/koszko.html fingerprint: E972 7060 E3C5 637C 8A4F 4B42 4BC5 221C 5A79 FD1A follow me on Fediverse: https://friendica.me/profile/koszko/profile =E2=99=A5 R29kIGlzIHRoZXJlIGFuZCBsb3ZlcyBtZQ=3D=3D | =C3=B7 c2luIHNlcGFyYXR= lZCBtZSBmcm9tIEhpbQ=3D=3D =E2=9C=9D YnV0IEplc3VzIGRpZWQgdG8gc2F2ZSBtZQ=3D=3D | ? U2hhbGwgSSBiZWNvbWUg= SGlzIGZyaWVuZD8=3D -- (sig_end) On Fri, 30 Jun 2023 23:13:55 -0400 Maxim Cournoyer wrote: > Hi, >=20 > =E5=AE=8B=E6=96=87=E6=AD=A6 writes: >=20 > > edk@beaver-labs.com writes: > > =20 > >> Dear Guix devs, > >> > >> While working around this bug: > >> > >> https://issues.guix.gnu.org/63912 > >> > >> I found that guix's Python will load anything in > >> .local/lib/python3.10/site-packages/ over any installed package in the > >> current profile. This makes pip-installed package overshadow guix's. > >> > >> I'm not sure this is desirable behavior. What I was expecting was for > >> the host system's python packages to be completely ignored. =20 > > > > Hello, I think this is a well-known issue according to PEP 668: > > https://peps.python.org/pep-0668/ =20 >=20 > Agreed, I think this works as designed: the Guix-installed dependencies > appear as *system* dependencies on the sys.path (see 'python -m site'), > and USER_SITE (which is ~/.local/lib/python3.10/site-packages) must have > precedence over it for locally user-installed packages to be able to > override the system packages. >=20 > That's for example necessary for virtualenvs to work as designed (it > used to be that virtualenvs were near useless, with the Guix-provided > dependencies taking precedence on the ones installed in a virtualenv). >=20 --Sig_/OKl/ez1mlXfdiFsnwwpREIr Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQTpcnBg48VjfIpPS0JLxSIcWnn9GgUCZKAO6QAKCRBLxSIcWnn9 GsswAQDj319n5Sh0qB5fk08bH2nDyE7/YBNE50+qEc9OX+Y3qwEAnIRidLl2amCY id5wQPhWDZvbGU8SC78x5119FvVZ1AU= =xASe -----END PGP SIGNATURE----- --Sig_/OKl/ez1mlXfdiFsnwwpREIr--