GeezerVison is showing github.com — BUG: upper cap < 3.12 · Issue #17957 · scipy/scipy
BUG: upper cap < 3.12 #17957Labels Official binariesItems related to the official SciPy binaries, including wheels and vendored libsdefectA clear bug or issue that prevents SciPy from being installed or used as expected DescriptionDescribe your issue.
We use poetry for dependency management and encounter the following problem when trying to add scipy:
Due to the upper cap on python 3.12 we can not add scipy via poetry, since we do no have such an upper cap.
Would it be possible to remove this upper cap or change it to 3.13?
Reproducing Code Example
Error message
(venv_new) >>>>charlotte@MacBook ~/Desktop/project % poetry add scipy
Using version ^1.10.0 for scipy
Updating dependencies
Resolving dependencies... (0.2s)
The current project's Python requirement (>=3.8) is not compatible with some of the required packages Python requirement:
- scipy requires Python <3.12,>=3.8, so it will not be satisfied for Python >=3.12
SciPy/NumPy/Python version information
1.10.0 Activityadded defectA clear bug or issue that prevents SciPy from being installed or used as expected on Feb 10, 2023tupui commented on Feb 10, 2023 Hi @anna-charlotte, thank you for reporting.
This is intentional as said in our release notes: SciPy 1.10 does not support Python 3.12.
We are very careful about our pins and since we have a complex build toolchain, new versions of Python usually mean something will break (don't want to say 100%, but...). And Python 3.12 is still in alpha.
We only start to support new Python versions when they enter the RC phase because during the beta phase we have time to fix things. tupui commented on Feb 10, 2023 sisp commented on Jul 18, 2023 I think capping the Python version is really a bad idea and considered bad practice:
Reacted by espdev and Hannes Krumbiegel tupui commented on Jul 18, 2023 Hi @sisp, we are aware of these links and have been participation in such discussions.
Pinning is a bad practice if done arbitrarily. There is no discussion here and we almost all agree on that.
In our case, it's a very sensible decision. New versions of Python always break SciPy in one way or another. We do not want to start saying that "some" things might work and some not. Remember that we have arguably one of the largest public API and with a very complicated infrastructure (Python, Cython, Pythran, C, C++, Fortran and our deps, all of that has to work together...) The same goes with pinning versions of NumPy. We have maintainers of NumPy in our team and we know for a fact which version of NumPy is going to break which version of SciPy. And over the years, we did not make that many mistakes 😉
Support for 3.12 will be there once we have a CI working on 3.12. Right now, SciPy does not work on 3.12, we cannot even install. So yes the pin is pretty correct here. Still, we already planned to make a release as soon as Python 3.12 is released and we know SciPy does work. sisp commented on Jul 20, 2023 I'm not convinced by these arguments, @tupui.
The same goes with pinning versions of NumPy. We have maintainers of NumPy in our team and we know for a fact which version of NumPy is going to break which version of SciPy. And over the years, we did not make that many mistakes wink
A change in NumPy may break SciPy, but likely not all of it but only a small fraction of the API. To restore functionality, SciPy would need a patch release. But many downstream projects that use SciPy would likely be unaffected anyway because they might not use the problematic SciPy API. By capping the NumPy version, you prevent a downstream project from using a more recent version of NumPy which may break the downstream project when it is affected by an unfixed bug in NumPy. Using an uncapped version of NumPy may break a downstream project that uses SciPy, but it can be fixed downstream, whereas a capped version of NumPy in SciPy that breaks a downstream project cannot be fixed downstream. See https://iscinumpy.dev/post/bound-version-constraints/#version-limits-break-code-too for a more comprehensive discussion of this problem.
New versions of Python always break SciPy in one way or another. We do not want to start saying that "some" things might work and some not. Remember that we have arguably one of the largest public API and with a very complicated infrastructure (Python, Cython, Pythran, C, C++, Fortran and our deps, all of that has to work together...)
Although I appreciate SciPy's complexity and API surface, I still think the above arguments also apply to the Python version constraint. In addition, when a downstream project uses, e.g., Poetry for dependency management, the (really strict) Python version capping gets propagated, i.e. any Poetry-managed downstream project that uses SciPy must cap the Python version as well.
$ poetry init --python='>=3.9' --dependency='scipy>=1.11.1'
$ poetry install
Creating virtualenv poetry-scipy in /tmp/poetry-scipy/.venv
Updating dependencies
Resolving dependencies... (0.2s)
The current project's Python requirement (>=3.9) is not compatible with some of the required packages Python requirement:
- scipy requires Python <3.13,>=3.9, so it will not be satisfied for Python >=3.13
Because no versions of scipy match >1.11.1
and scipy (1.11.1) requires Python <3.13,>=3.9, scipy is forbidden.
So, because poetry-scipy depends on scipy (>=1.11.1), version solving failed.
• Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
For scipy, a possible solution would be to set the `python` property to ">=3.9,<3.13"
https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
https://python-poetry.org/docs/dependency-specification/#using-environment-markers
Support for 3.12 will be there once we have a CI working on 3.12. Right now, SciPy does not work on 3.12, we cannot even install. So yes the pin is pretty correct here. Still, we already planned to make a release as soon as Python 3.12 is released and we know SciPy does work.
It looks like SciPy v1.11.1 caps the Python version to <3.13 (i.e. Python 3.12 is included), but wheel files are only available for Python <3.12 and I can't find CI checks for Python 3.12. 🤔 ilayn commented on Jul 20, 2023 If you want to go down the rabbit hole where we discussed this many many times already, and we know what you mean. Here is the canonical place that includes many SciPy maintainers discussing this with Python core members.
https://discuss.python.org/t/requires-python-upper-limits/12663
What is typically missed out in these discussions is that we have a multiple version span of NumPy and Python versions (and many other details like compiler/dependence problems Cython/pybind11 etc).
Upper capping is done for planned obsolescence and expectation management instead of letting the code fail in numerous cryptic ways.
People tend to downplay the breakage happening between different Python versions probably they are used to work with Python only packages but we have exceeding amount of ABI issues and that forces us to be strict. Hence you might not be convinced but read through all the discussions and linked issues and it will give you at least the reasoning we have. You can disagree but we are doing it this way to save a ton of maintainer work and we are not given any other solution so far. Reacted by Sigurd Spieckermann tupui commented on Jul 20, 2023
It looks like SciPy v1.11.1 caps the Python version to <3.13 (i.e. Python 3.12 is included), but wheel files are only available for Python <3.12 and I can't find CI checks for Python 3.12. 🤔
Yes, as I said above the current versions of SciPy don't install on Python 3.12, hence no wheel. The cap on <3.13 is because we will make a patch release as soon as 3.12 is out.
We are confident we will have this figured out by then. We have an opened PR to test on 3.12 and someone is looking at fixing the issues we have here. See #18689
In any case, we won't release a wheel until Python 3.12 is officially released.
Poetry for dependency management, the (really strict) Python version capping gets propagated
Yes, this is an issue with how Poetry think Python should deal with dependencies, not taking into account the fact that sometimes maintainers do know what they are doing 😉
A change in NumPy may break SciPy, but likely not all of it but only a small fraction of the API.
We are very strict here. SciPy is only released if the test suite is passing. We literally have millions of users and you would be surprised to see how SciPy is used. People rely on this stability and we are not going to change our position here.
Some projects are using our nightlies to test their library. SciPy is breaking things like scikit-image, scikit-learn and networkX all the time. And it's not always a very used function which breaks.
To restore functionality, SciPy would need a patch release.
Making a patch release is not trivial at all. To the end user, they just see a wheel, but getting there requires many manual steps on our side. Due to the complexity of the project and the time needed to make a release, we only do patch releases in between major versions. Meaning as soon as 1.12 would be out, we would stop making patch releases for 1.11. andyfaff commented on Jul 21, 2023
I can't find CI checks for Python 3.12
That's now being done. andyfaff commented on Jul 22, 2023
MetadataMetadataOfficial binariesItems related to the official SciPy binaries, including wheels and vendored libsdefectA clear bug or issue that prevents SciPy from being installed or used as expected DevelopmentNo branches or pull requestsIssue actions
|