From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Wojtek Kosior <koszko@koszko.org>
Cc: Csepp <raingloom@riseup.net>, help-guix@gnu.org
Subject: Re: program prepared with `guix pack` unusable by end users
Date: Fri, 28 Oct 2022 11:38:46 -0400 [thread overview]
Message-ID: <87o7twez5l.fsf@gmail.com> (raw)
In-Reply-To: <20221027192825.08f0af15@koszkonutek-tmp.pl.eu.org> (Wojtek Kosior's message of "Thu, 27 Oct 2022 19:28:25 +0200")
Hello,
Wojtek Kosior <koszko@koszko.org> writes:
>> > IMHO yes, the pack output does not work as expected. That's the
>> > definition of a bug.
>>
>> I disagree. That Python gives precedence to USERSITE compared to
>> site-packages and GUIX_PYTHONPATH is by design, so that users can
>> override system provided libraries such as those by Guix. It used to be
>> the other way around, and it caused all sort of problems such as
>> virtualenv not working as expected on Guix.
My memory failed me here; the past problems with Guix and virtualenv had
to do with us (ab)using PYTHONPATH, which would take precedence above
everything and not get reset by virtualenv, if I remember.
--8<---------------cut here---------------start------------->8---
$ . bin/activate
(venv) maxim@hurd /tmp/venv [env]$ python -m site
sys.path = [
'/tmp/venv',
'/gnu/store/bbakd2h7s4g62fymjmqpxgvlanp1ydny-python-3.9.9/lib/python39.zip',
'/gnu/store/bbakd2h7s4g62fymjmqpxgvlanp1ydny-python-3.9.9/lib/python3.9',
'/gnu/store/bbakd2h7s4g62fymjmqpxgvlanp1ydny-python-3.9.9/lib/python3.9/lib-dynload',
'/tmp/venv/lib/python3.9/site-packages',
]
USER_BASE: '/home/maxim/.local' (exists)
USER_SITE: '/home/maxim/.local/lib/python3.9/site-packages' (doesn't exist)
ENABLE_USER_SITE: False
--8<---------------cut here---------------end--------------->8---
We can see that virtualenv disables loading libraries from USER_SITE
(ENABLE_USER_SITE: False). We can also see that it puts its
site-packages directly on sys.path.
> Perhaps the best solution would be to
> * have Python interpreter itself give precedence to user site packages but
> * have user site disabled (or enabled with lower precedence) by default
> for Python applications.
>
> Consider the creation of wrapper script for python programs as it is
> done now[1]. Is there currently any application that would behave
> incorrectly with PYTHONNOUSERSITE exported as 1 and
> `~/.local/lib/python<PYTHON-VERSION>/site-packages/` included in
> GUIX-PYTHONPATH after the other paths? If there is, perhaps it would be
> at least easier to make a workaround for this single application?
I agree that setting PYTHONNOUSERSITE to 1 in the wrapper of Python
commands to ensure no stray user-installed librairies from under
"~/.local/lib/python<PYTHON-VERSION>/site-packages/" clash with their
operation would make sense.
Note that this is an interoperability problem between 'guix' and 'pip',
for 'pip install x' users that end up filling their
"~/.local/lib/python<PYTHON-VERSION>/site-packages/" directory. If you
'rm -rf ~/.local/lib/python*' and stick to use only Guix-provided
packages, they won't experience any issue.
--
Thanks,
Maxim
next prev parent reply other threads:[~2022-10-28 15:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 16:20 program prepared with `guix pack` unusable by end users Wojtek Kosior via
2022-10-13 17:34 ` (
2022-10-14 7:33 ` zimoun
2022-10-14 9:09 ` Wojtek Kosior via
2022-10-14 11:00 ` zimoun
2022-10-17 13:36 ` Wojtek Kosior via
2022-10-26 7:23 ` Wojtek Kosior via
2022-10-26 19:55 ` Csepp
2022-10-27 16:59 ` Maxim Cournoyer
2022-10-27 17:28 ` Wojtek Kosior via
2022-10-28 15:38 ` Maxim Cournoyer [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-10-13 6:26 Greetd autologin? kiasoc5
2022-10-13 6:33 ` (
2022-10-13 7:17 ` program prepared with `guix pack` unusable by end users Wojtek Kosior via
2022-10-13 8:26 ` (
2022-10-13 9:51 ` Wojtek Kosior via
2022-10-13 13:19 ` zimoun
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=87o7twez5l.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=help-guix@gnu.org \
--cc=koszko@koszko.org \
--cc=raingloom@riseup.net \
/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.