[issue43976] Allow Python distributors to add custom site install schemes

Marc-Andre Lemburg report at bugs.python.org
Tue May 4 16:52:32 EDT 2021


Marc-Andre Lemburg <mal at egenix.com> added the comment:

On 04.05.2021 22:29, Steve Dower wrote:
> 
> Would "pip install --user ..." in a Docker container also work, though? Presumably all the filesystem paths are being redirected anyway, so is there a difference?
> 
> (My assumption is that "--user" would essentially become the default if you're using the OS provided pip/Python. If you do your own build/install of it then you obviously get "default" behaviour, for better or worse.)

More modern Docker setups run the application itself under a non-root
user, but still install the packages and other dependencies as root.

See eg. Zammad's Dockerfile:
https://github.com/zammad/zammad-docker/blob/master/Dockerfile

Not sure whether that answers your question, though.

It's rather uncommon to install venvs inside Docker containers: one of the
main reasons for using containers is the added isolation, but it doesn't
make a lot of sense to add another layer of isolation inside the container.

"pip install as root" will need to continue to work and thus distros
need to get a way to make sure that it doesn't corrupt the system
installed packages. And perhaps distros can also patch pip to not
output those silly warnings anymore when using the system pip package :-)

Regarding the proposed solution: I'm not sure whether a new configure
option is the right way to go about this. Distros could simply patch
sysconfig.py, since that's the golden source of this information from
Python 3.10 onward.

setuptools' distutils version (and other packages which ship distutils)
will have to use this information instead of the copy which is/was
backed into distutils/sysconfig.py on Python 3.10+

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43976>
_______________________________________


More information about the Python-bugs-list mailing list