I’m not sure whether to discuss this on the setuptool, distutils or pip tracker, so I’ll ask here.
The distutils (and so, setuptools) install has the concept of install schemes, which control where a package gets installed: system-wide, or to a user’s home.
For a long time, Debian has a patch, distutils-install-layout.diff that adds more install shcemes,
deb_system, and implements logic to select them. The
unix_local scheme installs to
/usr/local rather than
Fedora does a similar thing in a more hacky/minimal (depending on your point of view) way. It also changes the install prefix from
/usr/local, in the default case.
These patches assume that the stdlib is tied to an interpreter and can’t be changed. Now that setuptools is replacing stdlib distutils with its own copy, these customizations are starting to disappear.
Is there a supported way to do customizations like this?
I can describe Fedora’s reasons for the patch: it’s to minimize damage to the system caused by
Since critical software including the system package manager is written in Python, when
sudo pip install updates a library to an incompatible version, the package manager can stop working. And unfortunately, the Internet is full of advice telling people to use
The solution in Fedora is to:
- install system software (from RPMs) in
pip(i.e. distutils) install to
site.py, put both
/usr/local/lib*/python*(and their site-packages) on
System software then uses Python’s
-Ioption, which skips site customization and thus omit the
/usr/local, so it’s not affected by changes from
If newer setuptools replace distutils with its own version using a
.pth file, the following can happen:
sudo pip install -U setuptools, putting an unpatched copy of
sudo pip install -U ..., which installs to
/usrdirectly, possibly breaking system software.
Is there any supported way to solve the this issue?