From: ng0@n0.is
To: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Cc: guix-devel@gnu.org
Subject: Re: Down with PYTHONPATH!
Date: Fri, 14 Jun 2019 10:12:44 +0000 [thread overview]
Message-ID: <20190614101244.kejwwxlvyyb7ouxt@uptimegirl> (raw)
In-Reply-To: <87muikr3bq.fsf@mdc-berlin.de>
Ricardo Wurmus transcribed 2.0K bytes:
> Hi Guix,
>
> here’s a half-baked idea that I think is worth considering: let’s patch
> our Python package to respect GUIX_PYTHONPATH and use GUIX_PYTHONPATH in
> our wrappers.
>
> PYTHONPATH is dangerously inadequate for use in a wrapper. Consider the
> case where a user has Numpy installed with Guix but also uses some
> unrelated application that happens to have been installed to
> ~/.local/bin via pip.
>
> Since numpy is part of the manifest Guix will helpfully record a value
> for PYTHONPATH in etc/profile. It’s very likely that users rely on
> etc/profile magic to set all needed environment variables, so PYTHONPATH
> will likely be set to a location that makes sense for Python
> applications in Guix.
>
> The user now runs ~/.local/bin/myapp and the thing crashes because the
> system Python will to load up Numpy from Guix, which is incompatible.
> The system Python may even be Python 2.7.
>
> PYTHONPATH is the wrong mechanism for Guix to use. We have previously
> discussed this and Hartmut Goebel analyzed the situation for us in the
> past (see the thread containing the message with ID
> <ad6b1473-2732-ca7b-d971-e548c39013f6@crazy-compilers.com>).
> Unfortunately, we couldn’t decide on a good way forward.
>
> So I propose to avoid using PYTHONPATH, which is similarly dangerous as
> LD_LIBRARY_PATH in that it causes incompatible libraries to be loaded.
> Switching to GUIX_PYTHONPATH is not going to be a complete solution
> (because it doesn’t distinguish between different versions of Python),
> but at the very least it will separate Python applications that use Guix
> from Python applications that don’t. Right now this is not the case and
> people who use Guix for some things but not for others have a really bad
> time and learn to avoid Guix because it sets PYTHONPATH, which breaks
> their other applications.
>
> If we’re feeling lucky we could even introduce GUIX_PYTHON2_PATH and
> GUIX_PYTHON3_PATH to solve the other half of the problem, namely that
> Python 2 applications will load Python 3 libraries (and vice versa).
>
> What do you think?
Sounds like a reasonable strategy for avoiding mixed python loading,
and the other cases you described above.
> --
> Ricardo
>
next prev parent reply other threads:[~2019-06-14 10:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 8:14 Down with PYTHONPATH! Ricardo Wurmus
2019-06-14 10:12 ` ng0 [this message]
2019-06-14 21:29 ` Ludovic Courtès
2019-06-15 7:44 ` Ricardo Wurmus
2019-06-15 9:15 ` Konrad Hinsen
2019-06-17 9:03 ` Ludovic Courtès
2019-06-17 10:20 ` Konrad Hinsen
2019-06-17 15:48 ` Pjotr Prins
2019-06-18 15:46 ` Konrad Hinsen
2019-06-19 11:25 ` Hartmut Goebel
2019-06-17 12:17 ` Hartmut Goebel
2019-06-15 13:35 ` Hartmut Goebel
2019-06-15 14:50 ` Ricardo Wurmus
2019-06-17 9:11 ` Ludovic Courtès
2019-06-17 18:34 ` Ricardo Wurmus
2019-06-18 8:28 ` Hartmut Goebel
2019-07-06 10:45 ` Hartmut Goebel
2019-07-06 16:31 ` Pjotr Prins
2019-07-18 8:20 ` Ricardo Wurmus
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=20190614101244.kejwwxlvyyb7ouxt@uptimegirl \
--to=ng0@n0.is \
--cc=guix-devel@gnu.org \
--cc=ricardo.wurmus@mdc-berlin.de \
/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.