= 0.29, <3.0; python_version >= "3.3" and pyprojec...">

setup_requires with python_version conflicts with identical pyproject.toml build-system.requires · Issue #10883 · pypa/pip (original) (raw)

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