GNU bug report logs - #76027
PyPy is Broken

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: "jgart" <jgart@HIDDEN>; dated Mon, 3 Feb 2025 09:19:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 76027 <at> debbugs.gnu.org:


Received: (at 76027) by debbugs.gnu.org; 10 Mar 2025 19:47:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 10 15:47:59 2025
Received: from localhost ([127.0.0.1]:39914 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1trj6V-0005Lr-4X
	for submit <at> debbugs.gnu.org; Mon, 10 Mar 2025 15:47:59 -0400
Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:53268)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1trj6I-0005KD-C1
 for 76027 <at> debbugs.gnu.org; Mon, 10 Mar 2025 15:47:46 -0400
Received: by mail-wm1-x333.google.com with SMTP id
 5b1f17b1804b1-43cf06eabdaso19893915e9.2
 for <76027 <at> debbugs.gnu.org>; Mon, 10 Mar 2025 12:47:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1741636060; x=1742240860; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=kn0k7DcJdjCGFpLkYsq+YpHbN0IqaAt6XInVvNf3rfk=;
 b=I8fNq0wSQn5iDLzk1a7qwWWuj8YChwXNQAnSJAPuwHfcQcL/1MAKPldv5vmrhj22t7
 sCxadvvNyU6JzeeHETVhrYHJSC+LVKrNRStferEUEK3oQdXcCEaX18nBgGkEv9VrvoFL
 j3YxZGN4NsUfD9WvV9InXAqVfaSFZPRtxePTc6wob3Zpxjd3yU0KfLC4kYCPevB3P21X
 EEjgx8LIgiiBQhBsZtZZQMjr3PElH2Vjktc9vp4tNFq7PIWQFrCZhqvf+r+4KMd7o27c
 rX70vM+XbxS42pqEe2LmvNT9eAKDp7OdH/CXAlIcwIZtvdYssi3vm0O3d0v6rrxCb2Iw
 k2bQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1741636060; x=1742240860;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject
 :date:message-id:reply-to;
 bh=kn0k7DcJdjCGFpLkYsq+YpHbN0IqaAt6XInVvNf3rfk=;
 b=u15gxNul+H8ODl/DhZ9XMloegr/JhakW6nz+yzS7ldRfLU2thfTzM0EcM5Zhtly3Nv
 LOYaNDlmCXzTGBvYI/mPk9vObHtwEl4YKM7Em9gyg2mjF/OTL49JMgcGapn0WteL+VjA
 ncuUhZQSwzQgRSBEN9Awx1s49/zUlRrzl+sJFSO8xRmSZJvPsWpt0Jv1ki1kGLwqEXqI
 lhPTcPu/FlnfWS6bIh4qFc2doZAsAwiWkB1MlpFC616VXIYCq81gj3uOUxcJFjLJ56MD
 ynx20t8x9AYS8D/tqGR/Wpf7LZtNQM9CdMjAZp4UU37dRiZmGCFUljxgVYSo5+vdbu0b
 dulw==
X-Forwarded-Encrypted: i=1;
 AJvYcCVYMmfh7RXCOvOWaDcfNSGiOW52KjfM4NwA6h3pCC1xxj4qQr0A6J1pxaUIJ+AO1XEpG0oCNA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyNLgBnON0G6pqE+9PC/1N5pLNlauukKk5LKeC4Zqt3b+imq/9K
 W1zoz2FB/LEgb4ZIPLeJ7L3ScsiidwLAPrUt+i01mC/rh4jlKWKjzPp0ZQ==
X-Gm-Gg: ASbGnctft9wMPRRtas56OYJJxubRtreVJYjYj9w26FFaLLTL9Erhks7s608A9ln6gCE
 RLCW7YMGmvex8OORez/nCBaVDKqeUgzY9imHGRMYCxl77HlGN8qRV/YxTUymXzsM2RTZP/L2fc0
 agdHF8uaM8ErTWZnEniLxLx0xgATjcMjOLUoKLyPxgLKDpdBNM3rYdTkwwsBV6HkT3ueNPU4+28
 CgrMz6WiRXSQSNZwwYCjsRV9y/ya+QAUs2+ZOlGNVMBTyrEH80geJiRpy4zzjoaojMLdsrEoHSz
 Mqqf0mEZ1Qad7GKN7YFzfZ3wIKlOXpqt9vTY8AnQvyjt+eMg4zr5Z7DNLqmPTQB6XDVRVslN8E5
 yLQmv+OdBHPoBnQiuyiy8fBJIVudsmogfc8E2hMIb
X-Google-Smtp-Source: AGHT+IGUaG4+ZMrDe1+xnsAf41iESEmtV+2avI8j1BTP/4q1I3IbSMZ0tKjuoV63F92OSvWbvhtVbQ==
X-Received: by 2002:a05:600c:5112:b0:43b:8198:f713 with SMTP id
 5b1f17b1804b1-43c5a630255mr130050615e9.4.1741636059876; 
 Mon, 10 Mar 2025 12:47:39 -0700 (PDT)
Received: from lili (roam-nat-fw-prg-194-254-61-44.net.univ-paris-diderot.fr.
 [194.254.61.44]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-43cf86b1d80sm46357125e9.9.2025.03.10.12.47.39
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 10 Mar 2025 12:47:39 -0700 (PDT)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: jgart <jgart@HIDDEN>, 76027 <at> debbugs.gnu.org
Subject: Re: bug#76027: PyPy is Broken
In-Reply-To: <fdb3b571ff08b0d2367086b56dc28ca9e150bffa@HIDDEN>
References: <fdb3b571ff08b0d2367086b56dc28ca9e150bffa@HIDDEN>
Date: Mon, 10 Mar 2025 19:08:03 +0100
Message-ID: <877c4wkbcs.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 76027
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Hi jgart,

On Mon, 03 Feb 2025 at 09:18, "jgart" via Bug reports for GNU Guix <bug-gui=
x@HIDDEN> wrote:

> ltrace -e getenv pypy -c "import django"
=E2=80=A6
> libpypy3.10-c.so->getenv("PYTHONPATH")                                   =
                        =3D nil

[=E2=80=A6]

> If instead I run the following commands I don't get an error response fro=
m ltrace:

Not sure the test=E2=80=99s the relevant. :-)
I get this:

--8<---------------cut here---------------start------------->8---
$ guix shell -C python python-django strace ltrace \
       -- ltrace -e getenv python3 -c "import django" 2>&1 \
       | grep PYTHONPATH
libpython3.10.so.1.0->getenv("PYTHONPATH")       =3D nil
--8<---------------cut here---------------end--------------->8---

Anyway.


> I am thinking that it might not be as trivial as setting the
> native-search-paths in the pypy package record.
>
> I tried already and it didn't resolve the python paths.

Yes, it=E2=80=99s about search paths.

--8<---------------cut here---------------start------------->8---
$ guix shell -C pypy python-django --search-paths
export PATH=3D"/gnu/store/r2419kgd4ajcic5w5mgp1pn93dv1by47-profile/bin${PAT=
H:+:}$PATH"

$ guix shell -C python python-django --search-paths
export PATH=3D"/gnu/store/98fvbjbj3yz7b8hidn2m7hs28wh4fjgk-profile/bin${PAT=
H:+:}$PATH"
export GUIX_PYTHONPATH=3D"/gnu/store/98fvbjbj3yz7b8hidn2m7hs28wh4fjgk-profi=
le/lib/python3.10/site-packages${GUIX_PYTHONPATH:+:}$GUIX_PYTHONPATH"
--8<---------------cut here---------------end--------------->8---

And considering the current implementation, the behaviour you report is
expected: the package pypy does not trigger GUIX_PYTHONPATH search
paths.  For example, this tweak allows to add python-django in the
search paths

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/packages/pypy.scm b/gnu/packages/pypy.scm
index 90986ac096..f142cd1199 100644
--- a/gnu/packages/pypy.scm
+++ b/gnu/packages/pypy.scm
@@ -35,6 +35,7 @@ (define-module (gnu packages pypy)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages xml)
   #:use-module (guix gexp)
+  #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu))
@@ -194,6 +195,13 @@ (define-public pypy
            tk
            xz
            zlib))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "PYTHONPATH")
+            (files (list (string-append
+                          "lib/python"
+                          (version-major+minor (package-version python))
+                          "/site-packages"))))))
     (home-page "https://www.pypy.org/")
     (synopsis "Python implementation with just-in-time compilation")
     (description "PyPy is a faster, alternative implementation of the Pyth=
on
--8<---------------cut here---------------end--------------->8---

Then, let run:

--8<---------------cut here---------------start------------->8---
./pre-inst-env guix shell -C pypy python-django \
       -- pypy -c "import django; import this"
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
--8<---------------cut here---------------end--------------->8---

Well, the next step is to rely on GUIX_PYTHONPATH via sitecustomize.py,
IMHO.

Cheers,
simon




Information forwarded to bug-guix@HIDDEN:
bug#76027; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Feb 2025 09:18:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 04:18:19 2025
Received: from localhost ([127.0.0.1]:37770 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tesaw-0002zb-RB
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2025 04:18:19 -0500
Received: from lists.gnu.org ([2001:470:142::17]:59910)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <jgart@HIDDEN>) id 1tesau-0002zM-Iy
 for submit <at> debbugs.gnu.org; Mon, 03 Feb 2025 04:18:16 -0500
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 <jgart@HIDDEN>) id 1tesao-0005WI-Dc
 for bug-guix@HIDDEN; Mon, 03 Feb 2025 04:18:11 -0500
Received: from mx2.dismail.de ([2a01:4f8:1c17:7be2::2])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jgart@HIDDEN>)
 id 1tesam-0006zc-De; Mon, 03 Feb 2025 04:18:09 -0500
Received: from mx2.dismail.de (localhost [127.0.0.1])
 by mx2.dismail.de (OpenSMTPD) with ESMTP id 5a85e299;
 Mon, 3 Feb 2025 10:18:01 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=
 mime-version:date:content-type:content-transfer-encoding:from
 :message-id:subject:to; s=20190914; bh=rTn+Qb3DNAJMWTBExzdxkQpvS
 GHKLBU1hTKgvDmwRjo=; b=cxXuLnNnmiJMPCCzvhppsRChJS0K9Lzosr28rHclN
 zXMTJR+vpE9uYVrXpsW/PQrYFwtqiBT9WYfYbhzzlUm2RiaIBJlDcz9q+EBtkWfJ
 aj9uDSCU3y9DDsnA8pHtHAM8+YNWUHitfvoJ3kXcx8zoUWSUbWNpZPP5Rha1ucWl
 H0OV2bCMg/l7ohKVtOIShZfCQAX7S29Ck8kvtuZAD8nXWokcSeso/i151uOQeD/h
 HQl3kb+9UDLpgnjII0Q31glRwajvp3ptToFbZJvIaAX0A8t00uF+GqPe8fmhvDj2
 lerGmwVyVmS/X5Os31ZsTe2XvC9+JmxiBl4XiRsEce6NA==
Received: from smtp2.dismail.de (<unknown> [10.240.26.12])
 by mx2.dismail.de (OpenSMTPD) with ESMTP id f50647e3;
 Mon, 3 Feb 2025 10:18:01 +0100 (CET)
Received: from smtp2.dismail.de (localhost [127.0.0.1])
 by smtp2.dismail.de (OpenSMTPD) with ESMTP id fec62e95;
 Mon, 3 Feb 2025 10:18:01 +0100 (CET)
Received: by dismail.de (OpenSMTPD) with ESMTPSA id 0214b160
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Mon, 3 Feb 2025 10:18:00 +0100 (CET)
MIME-Version: 1.0
Date: Mon, 03 Feb 2025 09:18:00 +0000
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
From: "jgart" <jgart@HIDDEN>
Message-ID: <fdb3b571ff08b0d2367086b56dc28ca9e150bffa@HIDDEN>
TLS-Required: No
Subject: PyPy is Broken
To: bug-guix@HIDDEN
Received-SPF: pass client-ip=2a01:4f8:1c17:7be2::2;
 envelope-from=jgart@HIDDEN; helo=mx2.dismail.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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,
 RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

Hi,

I am reporting a bug that PyPy is broken on Guix and so users are aware t=
hat you can't currently use PyPy properly in a guix shell with Guix.

How do you reproduce this issue?

Run the following:

make -j6 && ./pre-inst-env guix shell pypy python-django strace ltrace

ltrace -e getenv pypy -c "import django"

Observe the following PYTHONPATH=20

libpypy3.10-c.so->getenv("PYTHONPATH")=20                                =
                          =3D nil

If instead I run the following commands I don't get an error response fro=
m ltrace:

make -j6 && ./pre-inst-env guix shell python-wrapper python-django strace=
 ltrace

ltrace -e getenv python -c "import django"

all the best,

jgart

ps

Not sure when I can prioritize fixing this.=20

I=20am thinking that it might not be as trivial as setting the native-sea=
rch-paths in the pypy package record.

I tried already and it didn't resolve the python paths.

My hypothesis is that the python-build-system or pyproject-build-system m=
akes assumptions that are not compatible with how pypy sets and looks up =
paths.

I'll have to do some more experiments to find out more about that.




Acknowledgement sent to "jgart" <jgart@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#76027; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 10 Mar 2025 20:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.