unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73304: Python in relocatable guix pack leads to wrong sys.path
@ 2024-09-16 19:23 Rutherther via Bug reports for GNU Guix
  2024-09-16 19:28 ` Rutherther via Bug reports for GNU Guix
  0 siblings, 1 reply; 2+ messages in thread
From: Rutherther via Bug reports for GNU Guix @ 2024-09-16 19:23 UTC (permalink / raw)
  To: 73304


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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#73304: Python in relocatable guix pack leads to wrong sys.path
  2024-09-16 19:23 bug#73304: Python in relocatable guix pack leads to wrong sys.path Rutherther via Bug reports for GNU Guix
@ 2024-09-16 19:28 ` Rutherther via Bug reports for GNU Guix
  0 siblings, 0 replies; 2+ messages in thread
From: Rutherther via Bug reports for GNU Guix @ 2024-09-16 19:28 UTC (permalink / raw)
  To: 73304


As a workaround, the profile in gnu/store can be used instead
of the one exposed by -S symlink. Specifically, getting
`realpath ./profile` and using that as the profile instead
of `./profile` directly resolves the issue.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-16 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16 19:23 bug#73304: Python in relocatable guix pack leads to wrong sys.path Rutherther via Bug reports for GNU Guix
2024-09-16 19:28 ` Rutherther via Bug reports for GNU Guix

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).