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

setup_requires with python_version conflicts with identical pyproject.toml build-system.requires #10883

Closed
1 task done
DWesl opened this issue Feb 5, 2022 · 2 comments · Fixed by #11030
Closed
1 task done
Labels
type: bug A confirmed bug or unintended behavior

Comments

@DWesl
Copy link

DWesl commented Feb 5, 2022

Description

If I create a new directory with two files, setup.cfg

[options]
setup_requires=
    cython >= 0.26, <0.27; python_version == "3.2"
    cython >= 0.29, <3.0; python_version >= "3.3"

and pyproject.toml

[build-system]
requires = [
    "setuptools", "wheel",
    'cython >= 0.26, < 0.27; python_version == "3.2"',
    'cython >= 0.29, < 3.0; python_version >= "3.3"'
]
build-backend = "setuptools.build_meta"

then run pip wheel . in that directory, I expect pip to be able to install the build requirements without issue, since the two lists are identical. Instead, I get ERROR: Some build dependencies for file:///tmp/pip-test conflict with the backend dependencies: cython==0.29.27 is incompatible with cython<0.27,>=0.26; python_version == "3.2".

Expected behavior

If I delete the python_version == "3.2" lines (which I expect to be irrelevant since I haven't had a python 3.2 install in over a decade), I get

pip3.9 wheel .
Looking in links: /usr/share/python-wheels
Processing /tmp/pip-test
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (pyproject.toml) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=955 sha256=65847eee8c84ea91b423c7b48fdd4406883d9f5c2c59ea8592342e9645fd9f64
  Stored in directory: /home/Daniel/.cache/pip/wheels/d0/70/2e/359a080dcdc25044fcb688184e51cb13e8f616d18dab4c4843
Successfully built UNKNOWN

pip version

21.3.1

Python version

3.9.10, but the problem shows up with python 3.5-3.10 (not 2.7)

OS

Cygwin (original example was on Windows and Linux)

How to Reproduce

rm -rf /tmp/pip-test
mkdir -p /tmp/pip-test
cd /tmp/pip-test
cat >setup.cfg <<EOF
[options]
setup_requires=
    cython >= 0.26, <0.27; python_version == "3.2"
    cython >= 0.29, <3.0; python_version >= "3.3"
EOF
cat >pyproject.toml <<EOF
[build-system]
requires = [
    "setuptools", "wheel",
    'cython >= 0.26, < 0.27; python_version == "3.2"',
    'cython >= 0.29, < 3.0; python_version >= "3.3"'
]
build-backend = "setuptools.build_meta"
EOF
pip3.9 wheel .

Output

Looking in links: /usr/share/python-wheels
Processing /tmp/pip-test
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
ERROR: Some build dependencies for file:///tmp/pip-test conflict with the backend dependencies: cython==0.29.27 is incompatible with cython<0.27,>=0.26; python_version == "3.2".

Code of Conduct

@DWesl DWesl added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Feb 5, 2022
@pradyunsg
Copy link
Member

This is possibly due to setup_requires and how setuptools handles setup_requires.

@DWesl
Copy link
Author

DWesl commented Feb 5, 2022

This is possibly due to setup_requires and how setuptools handles setup_requires.

In that case, I would expect python -c "from setuptools import setup; setup()" sdist bdist_wheel to fail in the same way. Instead I get warnings about missing metadata and a pair of distribution files in the dist/ directory (with Cython 0.29.25 installed).

EDIT: Perhaps more relevant to pip: python -m build also succeeds.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2022
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants