Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip 10 wheel fails when install.user is set in the config #5085

Closed
anntzer opened this issue Mar 19, 2018 · 11 comments
Closed

pip 10 wheel fails when install.user is set in the config #5085

anntzer opened this issue Mar 19, 2018 · 11 comments
Labels
auto-locked Outdated issues that have been locked by automation
Milestone

Comments

@anntzer
Copy link
Contributor

anntzer commented Mar 19, 2018

  • Pip version: 10.0.0.dev0 (94d186b)
  • Python version: 3.6
  • Operating system: Arch Linux

Description:

Tried to build a wheel using pyproject.toml while the install.user key is set in ~/.config/pip/pip.conf. Failed with the traceback below.

What I've run:

$ cat setup.py
from setuptools import setup
setup()

$ cat pyproject.toml
[build-system]
requires = ["setuptools", "wheel"]

$ cat ~/.config/pip/pip.conf
[install]
user = true

$ pip wheel -wdist .
Processing /tmp/testdir
  Installing build dependencies ... error
  Complete output from command /usr/bin/python -m pip install --ignore-installed --prefix /tmp/pip-build-env-x1otknjf https://pypi.python.org/packages/20/d7/04a0b689d3035143e2ff288f4b9ee4bf6ed80585cc121c90bfd85a1a8c2e/setuptools-39.0.1-py2.py3-none-any.whl#md5=ca299c7acd13a72e1171a3697f2b99bc https://pypi.python.org/packages/0c/80/16a85b47702a1f47a63c104c91abdd0a6704ee8ae3b4ce4afc49bc39f9d9/wheel-0.30.0-py2.py3-none-any.whl#md5=1d61793f816d6b60513364fe2de9c1b3:
  ERROR: Can not combine '--user' and '--prefix' as they imply different installation locations
  
  ----------------------------------------
Command "/usr/bin/python -m pip install --ignore-installed --prefix /tmp/pip-build-env-x1otknjf https://pypi.python.org/packages/20/d7/04a0b689d3035143e2ff288f4b9ee4bf6ed80585cc121c90bfd85a1a8c2e/setuptools-39.0.1-py2.py3-none-any.whl#md5=ca299c7acd13a72e1171a3697f2b99bc https://pypi.python.org/packages/0c/80/16a85b47702a1f47a63c104c91abdd0a6704ee8ae3b4ce4afc49bc39f9d9/wheel-0.30.0-py2.py3-none-any.whl#md5=1d61793f816d6b60513364fe2de9c1b3" failed with error code 1 in None
@dstufft dstufft added the !release blocker Hold a release until this is resolved label Mar 19, 2018
@dstufft dstufft added this to the 10.0 milestone Mar 19, 2018
@pradyunsg
Copy link
Member

@pypa/pip-committers I think just setting the appropriate environment variable to "" be fine as a fix for this?

@pfmoore
Copy link
Member

pfmoore commented Mar 19, 2018

I think this may be because the PEP 518 code for creating the build environment uses --prefix to decide where to install the build dependencies. So we need to force --user not to be set in that case. I'm not sure if setting the PIP_USER env var to "" has that effect, but if it does, then yes that would be a way of doing it. Or does --no-user work to force not installing in user-site regardless of the config file?

@pfmoore
Copy link
Member

pfmoore commented Mar 25, 2018

I'm looking at writing a test for this (as the first step towards putting together a fix) and I'm not sure I understand the PEP 518 build isolation process well enough. @pradyunsg can you help here?

In tests/functional/test_install.py the first test (test_without_setuptools) uninstalls setuptools, then runs an install of INITools. But my understanding of PEP 518 is that if a project doesn't have a pyproject.toml, it would be assumed to have build dependencies of (setuptools, wheel), and those would then be installed in the build environment. Clearly that's not what is going on here, as the test is succeeding (i.e., pip is failing to install because setuptools is not present).

I can probably just ignore this and make the OP's description of how to demonstrate the issue into a test (BTW, thanks @anntzer for a clear description!) but I'd still like to understand why the existing test works.

@pradyunsg
Copy link
Member

pradyunsg commented Mar 25, 2018 via email

@pfmoore
Copy link
Member

pfmoore commented Mar 25, 2018

Oh, I thought it worked on any top-level build of wheels, and as an install from sdist builds a wheel then installs it, I thought that would trigger the build isolation stuff. Thanks for the clarification.

(This might be something we should document in more detail at some point. Not a high priority though...)

@pradyunsg
Copy link
Member

pradyunsg commented Mar 25, 2018 via email

@pfmoore
Copy link
Member

pfmoore commented Mar 25, 2018

Yeah, that's in the test code. I didn't realise that changed the build path like that. My mistake. Thanks.

@pradyunsg
Copy link
Member

pradyunsg commented Mar 25, 2018 via email

@pfmoore
Copy link
Member

pfmoore commented Mar 25, 2018

BTW, it would be much nicer if we had a --no-user option, as that would explicitly override whatever was in the config file. Not sure why that doesn't work :-( For the same reason, I don't think it's possible to set the environment variable PIP_USER to anything that would work.

I've managed to get a working patch for this by adding an explicit --no-user option that stores False in the use_user_site option value, but (a) that's ugly as sin, and (b) I dread to think what interactions might exist (--user --no-user vs --no-user --user).

I don't have time to do more on this just now, so I've created #5116 with my work so far. If anyone wants to review and/or suggest better approaches, I'd be most grateful.

@pfmoore
Copy link
Member

pfmoore commented Mar 26, 2018

Fixed via #5116

@lock
Copy link

lock bot commented May 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

4 participants