I am using Python 3.8.7 and the latest version of Pip, v21.0.1. I have written a package that contains the following Python version constraint:
python_requires='>=3.6, <3.9',
When I try to install the package, Pip refuses and prints the following error:
ERROR: Package 'my-package' requires a different Python: 3.8.7 not in '<3.9,>=3.6'
I have seen a similar error when installing other packages with similar version constraints:
ERROR: Package 'my-other-package' requires a different Python: 3.8.7 not in '!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<3.9,>=2.7'
Clearly Python 3.8.7 is greater than 3.6 and less than 3.9, so why does Pip claim that a different version of Python is required?
Some investigation suggests that this may be an inaccurate error message. I have run an experiment uses packages with the following dependent relationship:
- package-a requires Python >= 3.6, and depends on package-b;
- package-b requires Python >= 3.6 and < 3.9.
I have found that when installing package-a using Python 3.9, I receive the following error:
ERROR: Package 'package-a' requires a different Python: 3.9.0 not in '>=3.6'
So basically, package-a cannot be installed with Python 3.9 because package-b does not work with Python 3.9; however, Pip erroneously states that package-a requires a "different" Python, and then erroneously prints out package-a's version specifier, rather than package-b.
I will continue to investigate, but this may be a bug in Pip itself.