pytensor icon indicating copy to clipboard operation
pytensor copied to clipboard

Test on numpy 2.0

Open ricardoV94 opened this issue 1 year ago • 6 comments

Description

We may need to pin <2.0 until any break changes are fixed (or we could be very lucky and nothing would happen). First step is to test, which we can do with RC versions

ricardoV94 avatar Apr 02 '24 09:04 ricardoV94

#689 confirmed we need to pin it. CC @maresb

ricardoV94 avatar Apr 05 '24 11:04 ricardoV94

Ok, I can put together a repodata patch to make it retroactive on conda-forge. The first step is to add it to our pyproject.toml, and ideally make a release containing the pin. (Conda-forge core prefers to see such retroactive changes being made for something that's already in the feedstock, so that's why a release would be good.)

Any idea on the timeline before the non-rc release drops?

maresb avatar Apr 05 '24 15:04 maresb

Any idea on the timeline before the non-rc release drops?

Couldn't find anything conclusive, but sounds like soon: https://github.com/numpy/numpy/issues/24300

ricardoV94 avatar Apr 05 '24 16:04 ricardoV94

On the conda-forge side I wrote a repodata patch, and then when I tested it didn't actually do anything...

Happily, in terms of Numpy, the conda-forge infrastructure currently automatically pins numpy<2.0.a0 to ensure binary compatibility, so my repodata patch was redundant. :tada:

There's the question of how to move forward once 2.0 becomes available, and this I'm less sure about. I'm testing adding a pin in https://github.com/conda-forge/pytensor-suite-feedstock/pull/88, but there's the possibility that this interferes with the conda-forge magic (see https://github.com/conda-forge/pytensor-suite-feedstock/pull/35).

My recommendation on how to proceed is that we keep an eye on the pins by checking the artifacts in conda-forge/pytensor-suite-feedstock before merging any of the version update PRs.

I'm very relieved that there is no threat of PyTensor breaking as soon as Numpy 2 is released. :sweat_smile:

maresb avatar Apr 06 '24 17:04 maresb

Here us the issue to track ecosystem compatibility with numpy 2.0 https://github.com/numpy/numpy/issues/26191#issuecomment-2031569341

danieltomasz avatar Apr 06 '24 23:04 danieltomasz

Hmmm, when looking around, I had stumbled on Aesara fork of Theano, but somehow not pytensor. The one potentitially complicated change is that right now I removed MapIter, because it is terribly slow (in the public API form) but having it public API means dragging. Aesara was saying that they wanted to get rid of that code anyway, and I am almost betting that calling back into Python might be better than using PyArray_MapIter (e.g. using ufunc.at() is usually now fast, but of course not when running on some older NumPy versions)

Please let me know if this is a big issue, or if I can give some pointers in how to just replace the whole thing.

seberg avatar Apr 24 '24 19:04 seberg

Is there a NumPy 2 tracking issue for PyMC as well?

Searched for one, but didn't find it (though could very easily have missed it)

jakirkham avatar May 08 '24 19:05 jakirkham

Is there a NumPy 2 tracking issue for PyMC as well?

Searched for one, but didn't find it (though could very easily have missed it)

No, the only blocker for PyMC is PyTensor compatibility with numpy 2.0 (I think)

ricardoV94 avatar May 08 '24 20:05 ricardoV94