Skip to content

Replace np.float and np.row_stack across 2 files (removed in NumPy 1.24 / NumPy 2.0) - #99

Closed
Azimml wants to merge 1 commit into
decile-team:mainfrom
Azimml:fix/numpy2-removed-aliases
Closed

Azimml wants to merge 1 commit into
decile-team:mainfrom
Azimml:fix/numpy2-removed-aliases

Conversation

@Azimml

@Azimml Azimml commented Aug 23, 2026

Copy link
Copy Markdown

Thanks for putting this code out — I've been reading through it.

On a current environment (Python 3.12, NumPy 2.x) it hits a few names that NumPy and the stdlib have since removed. Each one raises rather than warning, so execution stops at the first one.

What breaks

Location Symbol Removed in
cords/utils/data/datasets/SL/builder.py:469 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:470 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:476 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:477 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:480 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:481 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:487 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:488 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:491 np.row_stack NumPy 2.0
cords/utils/data/datasets/SL/builder.py:492 np.row_stack NumPy 2.0
cords/utils/data/datasets/SSL/augmentation/augmentation_pool.py:256 np.float NumPy 1.24

How I checked

I executed each of these expressions against NumPy 2.x to confirm it genuinely raises (rather than assuming from the name), and confirmed the replacement returns the same value. I didn't run the full pipeline here — package import blocked by asyncore (removed in Python 3.12) - a separate issue, flagged in the PR body but not fixed here — so I've kept the change strictly to these substitutions.

What this PR changes

Old New Why it's equivalent
np.float float np.float was the builtin float
np.row_stack np.vstack row_stack was always an alias for vstack

No behavioural or numerical change — these are exact substitutions. Every touched file still compiles.

Separately, and not touched by this PR: on Python 3.12 the package currently fails to import earlier than this, with ModuleNotFoundError: No module named 'asyncore' (asyncore was removed in 3.12). That's a different problem and deserves its own change — happy to open a second PR for it if it'd be useful.

Happy to rework this if you'd rather pin NumPy below 2 instead, or if you'd prefer it split up differently.

  np.float                 -> float            (removed in NumPy 1.24)
  np.row_stack             -> np.vstack        (removed in NumPy 2.0)

Each of these raises rather than warning, so execution stops at
the first one on a current environment. The replacements are exact
equivalents - no behavioural or numerical change.

Touches 2 file(s); all still compile.
@Azimml Azimml changed the title Fix NumPy 2.x / Python 3.12 incompatibilities Replace np.float and np.row_stack across 2 files (removed in NumPy 1.24 / NumPy 2.0) Aug 23, 2026
@Azimml Azimml closed this by deleting the head repository Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant