Skip to content

python_requires should be evaluated before installing requirements when using extras_require #10542

Open
@kmaehashi

Description

@kmaehashi

Description

When installing a package with extras_require specifier (i.e., pip install xxx[yyy]), python_requires tag of xxx is evaluated after installing extra requirements listed in yyy. This seems like a regression in pip 21.2; pip 21.1.3 immediately stops the installation before installing extra requirements.

Expected behavior

python_requires tag is evaluated before installing extra requirements.

pip version

Confirmed with 21.2.0 and 21.2.4

Python version

Confirmed with 3.9.0 and 3.6.5

OS

Ubuntu 18.04

How to Reproduce

Create the following file as setup.py, then run pip install '.[foo]'.

from setuptools import setup

setup(
    name='pip-bug-repro',
    extras_require={'foo': ['idna<4,>=2.5']},
    python_requires='>3.10',
)

Output

### pip 21.1.3

% pip install '.[foo]'
Processing /home/kenichi/Development/pip-bug
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
Collecting idna<4,>=2.5
  Using cached idna-3.2-py3-none-any.whl (59 kB)
INFO: pip is looking at multiple versions of pip-bug-repro[foo] to determine which version is compatible with other requirements. This could take a while.
ERROR: Package 'pip-bug-repro' requires a different Python: 3.9.0 not in '>3.10'
WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.
You should consider upgrading via the '/home/kenichi/.pyenv/versions/3.9.0/envs/local-3.9.0/bin/python3.9 -m pip install --upgrade pip' command.


### pip 21.2.0 / 21.2.4

% pip install '.[foo]'
Processing /home/kenichi/Development/pip-bug
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
Collecting idna<4,>=2.5
  Using cached idna-3.2-py3-none-any.whl (59 kB)
INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of idna to determine which version is compatible with other requirements. This could take a while.
  Using cached idna-3.1-py3-none-any.whl (58 kB)
  Using cached idna-3.0-py2.py3-none-any.whl (58 kB)
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
  Using cached idna-2.9-py2.py3-none-any.whl (58 kB)
  Using cached idna-2.8-py2.py3-none-any.whl (58 kB)
  Using cached idna-2.7-py2.py3-none-any.whl (58 kB)
  Using cached idna-2.6-py2.py3-none-any.whl (56 kB)
INFO: pip is looking at multiple versions of idna to determine which version is compatible with other requirements. This could take a while.
  Using cached idna-2.5-py2.py3-none-any.whl (55 kB)
INFO: pip is looking at multiple versions of pip-bug-repro[foo] to determine which version is compatible with other requirements. This could take a while.
ERROR: Package 'pip-bug-repro' requires a different Python: 3.9.0 not in '>3.10'

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions