From: Rutherther via Bug reports for GNU Guix <bug-guix@gnu.org>
To: 73304@debbugs.gnu.org
Subject: bug#73304: Python in relocatable guix pack leads to wrong sys.path
Date: Mon, 16 Sep 2024 19:23:04 +0000 [thread overview]
Message-ID: <87ed5j1jzd.fsf@protonmail.com> (raw)
When I add both python and a python package (seems like any) to a
relocatable guix pack, the resulting python in the merged profile seems
to be broken. Specifically its `sys.path` contains missing paths.
To replicate:
```
mkdir -p /tmp/b && cd /tmp/b
tar xzvf $(guix pack -RR python python-pyflakes -S /profile=)`
```
Then try executing the python from merged profile, and see sys.path output
--8<---------------cut here---------------start------------->8---
./profile/bin/python3
>>> import sys
>>> print(sys.path)
['', '/tmp/b/pwajwfiygrkmag8fm1wzn3cf362j7sri-python-3.10.7R/lib/python310.zip', '/tmp/b/pwajwfiygrkmag8fm1wzn3cf362j7sri-python-3.10.7R/lib/python3.10', '/tmp/b/pwajwfiygrkmag8fm1wzn3cf362j7sri-python-3.10.7R/lib/python3.10/lib-dynload', '/tmp/b/pwajwfiygrkmag8fm1wzn3cf362j7sri-python-3.10.7R/lib/python3.10/site-packages']
--8<---------------cut here---------------end--------------->8---
Now if you instead use the realpath of this python
--8<---------------cut here---------------start------------->8---
$(realpath ./profile/bin/python3)
>>> import sys
>>> print(sys.path)
['', '/tmp/b/gnu/store/pwajwfiygrkmag8fm1wzn3cf362j7sri-python-3.10.7R/lib/python310.zip', '/tmp/b/gnu/store/pwajwfiygrkmag8fm1wzn3cf362j7sri-python-3.10.7R/lib/python3.10', '/tmp/b/gnu/store/pwajwfiygrkmag8fm1wzn3cf362j7sri-python-3.10.7R/lib/python3.10/lib-dynload', '/tmp/b/gnu/store/pwajwfiygrkmag8fm1wzn3cf362j7sri-python-3.10.7R/lib/python3.10/site-packages']
--8<---------------cut here---------------end--------------->8---
As can be observed, the first instance misses "gnu/store" in the path,
and instead points to a path that does not exist. I have not
investigated, at least not yet, where this discrepancy comes from.
I was not able to replicate this with anything else than relocatable
pack. So my guess would be something strange happens when making
bwrap/fakechroot etc.
Regards,
Rutherther
next reply other threads:[~2024-09-16 19:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-16 19:23 Rutherther via Bug reports for GNU Guix [this message]
2024-09-16 19:28 ` bug#73304: Python in relocatable guix pack leads to wrong sys.path Rutherther via Bug reports for GNU Guix
2024-09-30 21:08 ` Ludovic Courtès
2024-10-01 19:39 ` Rutherther via Bug reports for GNU Guix
2024-10-02 6:20 ` Konrad Hinsen
2024-10-02 11:59 ` Konrad Hinsen
2024-10-06 8:29 ` Konrad Hinsen
2024-10-14 11:11 ` Ludovic Courtès
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ed5j1jzd.fsf@protonmail.com \
--to=bug-guix@gnu.org \
--cc=73304@debbugs.gnu.org \
--cc=rutherther@protonmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.