guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Update python-pip to 9.0.1


From: Ludovic Courtès
Subject: Re: [PATCH] Update python-pip to 9.0.1
Date: Mon, 09 Jan 2017 15:52:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hello!

Maxim Cournoyer <address@hidden> skribis:

> This is my 2nd and hopefully correct attempt at updating python-pip to
> 9.0.1. Test inputs were removed as the tarball available from pypi is
> stripped from any test.
>
> It also incorporates suggestions that were previously made [1]; for
> example we no longer need to use setuptools as an input since our Python
> package definitions were recently updated to always be built with
> pip/setuptools (the ensurepip flag).

Sounds good.

> From bfd91a59acdf3105505d7dd8483bb9cb97137cbf Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <address@hidden>
> Date: Mon, 28 Nov 2016 16:30:07 -0800
> Subject: [PATCH] gnu: python-pip: Update to 9.0.1
>
> * gnu/packages/python.scm (python-pip, python2-pip): Update to 9.0.1.

I applied and expounded the commit log a bit.

One thing which I discovered while testing pip on Guix was that
depending on how you use Python on Guix the PYTHONPATH differs:

> # PYTHONPATH in an environment
> $ guix environment python-wrapper
> [env]$ python3 -c 'import sys; print(sys.path)'
> ['',
> '/gnu/store/ar7k7ds90ikxv40a6lif6jv2g39l7mls-profile/lib/python3.5/site-packages',
> '/gnu/store/b7zbbavbk1jv40b9virwmglck9bdj43a-python-3.5.2/lib/python35.zip',
> '/gnu/store/b7zbbavbk1jv40b9virwmglck9bdj43a-python-3.5.2/lib/python3.5',
> '/gnu/store/b7zbbavbk1jv40b9virwmglck9bdj43a-python-3.5.2/lib/python3.5/plat-linux',
> '/gnu/store/b7zbbavbk1jv40b9virwmglck9bdj43a-python-3.5.2/lib/python3.5/lib-dynload',
> '/home/maxim/.local/lib/python3.5/site-packages',
> '/gnu/store/b7zbbavbk1jv40b9virwmglck9bdj43a-python-3.5.2/lib/python3.5/site-packages']

The above command creates an environment containing the dependencies of
python-wrapper.

Instead, you probably wanted to run this:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix environment --ad-hoc python-wrapper -- python -c 'import 
sys; print(sys.path)'
substitute: updating list of substitutes from 'https://mirror.hydra.gnu.org'... 
100.0%
The following derivations will be built:
   /gnu/store/bxr0cw01qhgd9r741a6nnm5zwx3y12rr-profile.drv
   /gnu/store/l91wf51q5ravikki293baljfx0bacqm8-info-dir.drv
   /gnu/store/a4mz2l85sc11w6llh56zxlcc1bmfmzsr-ca-certificate-bundle.drv
   /gnu/store/3z9hsnrwvqw70h0ssxqw0vy5y2dvzcj4-fonts-dir.drv
['', 
'/gnu/store/w63slncr9gyzjrs09n8ls81xac9fs804-profile/lib/python3.5/site-packages',
 '/home/ludo/.guix-profile/lib/python3.5/site-packages', 
'/gnu/store/alk9r3rir93pjmv8im20f8xrvv90219z-python-3.5.2/lib/python35.zip', 
'/gnu/store/alk9r3rir93pjmv8im20f8xrvv90219z-python-3.5.2/lib/python3.5', 
'/gnu/store/alk9r3rir93pjmv8im20f8xrvv90219z-python-3.5.2/lib/python3.5/plat-linux',
 
'/gnu/store/alk9r3rir93pjmv8im20f8xrvv90219z-python-3.5.2/lib/python3.5/lib-dynload',
 
'/gnu/store/alk9r3rir93pjmv8im20f8xrvv90219z-python-3.5.2/lib/python3.5/site-packages']
--8<---------------cut here---------------end--------------->8---

… although it doesn’t make much of a difference in this particular case
since python-wrapper has python as its dependency.

> Conclusion: When using python in a "guix environment", the *system*
> site-packages directory appears _before_ the *user* site-packages
> directory in the PYTHONPATH, which is wrong and causes pip to not work
> as intended. [2]

‘guix environment’ without --pure adds its own entries to the front of
the search paths, which is why we observe this behavior.

In most cases this is what we want (we want to create an environment
that prevails over the user’s profile), but I can see why this is
problematic here.

I would argue that using ‘pip’ in ‘guix environment’ is a bit convoluted
anyway, but then again I’m no Python expert.  :-)

Thoughts?

Thanks!

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]