Skip to content

Support numpy >= 2.0 — deprecated alias replacements and minimum PETSc version #247

@jcgraciosa

Description

@jcgraciosa

Summary
The current numpy = "<2" pin in pixi.toml blocks environment solves as conda-forge moves to numpy 2.x by default. This issue proposes lifting it and asks the team to decide on two things.

Changes needed in underworld3 source
Several numpy 1.x APIs removed or deprecated in numpy 2.0 need replacing:

  • np.double → np.float64 (8 files)
  • np.row_stack → np.vstack (1 file)
  • np.core.* → public API equivalents in unit_aware_array.py
  • np.cross on 2D vectors → explicit z-component in discretisation_mesh.py
  • array(self) → array(self, dtype=None, copy=None) in 4 array-view classes

A prototype branch with all changes passes core single-process and 4-rank MPI tests with numpy 2.4.6 and PETSc 3.25.

Discussion points

  1. Accept the source changes? This is a clean break — numpy < 2 would no longer be supported.
  2. Minimum PETSc version for custom/HPC builds? I think this is 3.21.0?

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions