-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
setup.cfg [build] section in current directory confuses pip install of other packages #12015
Comments
This is unfortunately inherited from distutils for backward compatibility. This compatibility layer is being phased out, but is gated by Python version due to stdlib support. |
Thank you for filing this issue and for the effort put into filing this a clear issue! It is appreciated and made it much easier to understand what was happening; and ensuring that we understand what concern you're raising. As @uranusjr said, this is expected and known behaviours of distutils that we're phasing out. There are no known workarounds other than using a clean working directory. :) |
Completing that would fix this! Getting rid of distutils in
Unfortunately people like running pip commands in the project directory. I have figured out a monkey patch which lets me use a different name than |
1 similar comment
Completing that would fix this! Getting rid of distutils in
Unfortunately people like running pip commands in the project directory. I have figured out a monkey patch which lets me use a different name than |
Description
(Python before 3.10)
pip commands to install other stuff are typically run in a project directory, and some projects have a
setup.cfg
. If there are any[build]
options in thesetup.cfg
the generic build command doesn't know, then you get an exception.This happens in the pip code that wants to check if all possible install directories are writable. It is getting a list of install directories from the distutils install command. Creating that then creates a build command object which parses
setup.cfg
and falls over.Fix
This creates a dummy distutils build command that accepts all options. Changes are to
https://github.com/pypa/pip/blob/main/src/pip/_internal/locations/_distutils.py adding this
Then in
distutils_scheme()
add the middle line:This fix means the
setup.cfg
file is still used, but only theinstall
section, which is what was intended.More context
This was originally found using cibuildwheel. It has now been changed to not run some pip installs in the project directory. Lots more detail
It affects Python before 3.10 (by default). If https://github.com/pypa/pip/blob/main/src/pip/_internal/locations/_distutils.py#246 sees
USE_SYSCONFIG
asTrue
it ignores distutuls. The default is set at https://github.com/pypa/pip/blob/main/src/pip/_internal/locations/__init__.py#L43 where it gates by Python 3.10+Expected behavior
The
[build]
section in asetup.cfg
should have no effect on installing other packages.pip version
pip 23.1.2
Python version
3.7
OS
Linux
How to Reproduce
In an empty directory create a
setup.cfg
:Do a pip install:
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: