build icon indicating copy to clipboard operation
build copied to clipboard

Packages can't be installed in isolated env if pip is in `user' mode

Open layday opened this issue 3 years ago • 6 comments

If a user has configured pip to run in user mode, it will be unable to install packages in build's isolated environment. See: https://github.com/pypa/packaging-problems/issues/459#issuecomment-786992480.

layday avatar Feb 27 '21 15:02 layday

How do we override that?

FFY00 avatar Feb 27 '21 15:02 FFY00

I suppose we could set PIP_USER to 0 or pass --no-user to every pip command that we issue, if this is something that we want to handle in build.

layday avatar Feb 27 '21 15:02 layday

Is --no-user a supported flag? https://github.com/pypa/pip/issues/8977#issuecomment-706535089

dtrodrigues avatar Feb 28 '21 20:02 dtrodrigues

build is not an "end user" in this context.

layday avatar Feb 28 '21 21:02 layday

Just to make sure you have noticed the close reason, https://github.com/pypa/pip/issues/8977#issuecomment-706483689 :

pip has real config in a virtual environment, at $(sys.prefix)/pip.conf. Having a user = false there would override the user configuration.

It seems like it should be set on venv or virtualenv side, since no one would like to do a real pip install in virtual envrionment? Or is it better to be set by every module that creates virtual envrionment and wants to install modules inside? What do you think?

PaperStrike avatar Mar 01 '21 10:03 PaperStrike

It’d be pretty weird for the built-in venv to create a tool-specific config file; I’m more inclined to think pip and/or tools using virtual environments should fix this on its own.

Regarding pip, the logic around scheme selection really needs an complete redesign IMO (see discussion in pypa/pip#7829), and --user is only one sympton to the problem. But it has a lot of combinations and needs someone to sit down for a long time and work out all of the possibilities, which is unsurprisingly not a very popular task.

uranusjr avatar Mar 06 '21 13:03 uranusjr