[Distutils] Including soabi tag in --user path?

Nathaniel Smith njs at pobox.com
Sat Jul 15 00:41:38 EDT 2017


On Fri, Jul 14, 2017 at 9:37 PM, Ned Deily <nad at python.org> wrote:
> On Jul 15, 2017, at 00:22, Nathaniel Smith <njs at pobox.com> wrote:
>> A user on the pywavelets mailing list seems to have gotten themselves
>> into a mess: AFAICT they did 'pip install --user pywavelets' using a
>> ucs4 python, and then started a ucs2 python and tried to import it,
>> which of course failed because these two python builds have
>> incompatible ABIs, even though they share the same --user directory.
>>
>> In retrospect, this seems like an obvious oversight: right now the
>> --user path (on Linux) is something like
>>
>>  ~/.local/lib/python3.5/site-packages
>>
>> Wouldn't it make more sense for it to be something like
>>
>>  ~/.local/lib/cpython-35m-x86_64-linux-gnu/site-packages
>>
>> so that Pythons with incompatible ABIs can't see each other's
>> packages? (That's sysconfig.get_config_var("SOABI").)
>>
>> Obviously this can't really be fixed for old versions, but is this a
>> change that should be made in 3.7?
>
> I'm confused.  This shouldn't be an issue for Python 3.*.  First, there is no ucs2 / ucs4 option since Python 3.3 and PEP 393's flexible string representation.

Right, but there are still SOABI variations, e.g. debug builds versus
regular builds.

> But even before that, PEP 3149 (in 3.2) is supposed to ensure that extension modules have unique names based on ABI, for example:
>
> _psutil_osx.cpython-35m-darwin.so

Right, but this only helps if you install multiple builds of the same
package on top of each other. Which Debian is able to arrange, so PEP
3149 solves their problem. But the --user dir is managed by pip, and
if you try to install a cpython-35dm package on top of a cpython-35m
package, then pip will helpfully remove the first before installing
the second. (And this is really the only reasonable thing for pip to
do.) So in practice any given package in the --user dir can only
support one SOABI variant, even though all the SOABI variants use the
same dir.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Distutils-SIG mailing list