Skip to content

Fix Python 3.13 test failures (RXMC NumPy 2 bug; document/skip NequIP)#81

Merged
k-yoshimi merged 2 commits into
developfrom
fix-python313-tests
Jun 20, 2026
Merged

Fix Python 3.13 test failures (RXMC NumPy 2 bug; document/skip NequIP)#81
k-yoshimi merged 2 commits into
developfrom
fix-python313-tests

Conversation

@k-yoshimi

Copy link
Copy Markdown
Contributor

Overview

Make the test suite pass on Python 3.13. The Test for abICS workflow had been
auto-disabled by GitHub for inactivity; after re-enabling it, two pre-existing
Python 3.13 failures surfaced. Both are unrelated to the recent MLIP work; they
affect develop directly.

1. RXMC replica exchange crash under NumPy 2 (real bug — fixed)

abics/sampling/rxmc.py::find_procrank_from_Trank returned the raw
np.argwhere(...) result — a 2-D array of shape (1, 1) — which was then passed
as the MPI source/dest rank to comm.Recv/comm.Send. NumPy 2 rejects int()
on a non-0-dimensional array, raising

TypeError: only 0-dimensional arrays can be converted to Python scalars

so any replica exchange crashed on Python 3.13 (numpy>=2). NumPy 1.x silently
allowed the size-1 conversion, which is why Python 3.9 passed.

Fix: return a plain int(i[0, 0]), and fix the dead if i is None guard
(np.argwhere never returns None) to if i.size == 0.

Reproduced and verified locally with Python 3.13 / numpy 2.4.6 / mpi4py 4.1.2:
the mock, potts, and potts_pamc sampling tests and the 31 unit tests pass.

2. NequIP cannot run on Python 3.13 (upstream limitation — documented & skipped)

The supported nequip series (<0.7, pinned in pyproject.toml) calls the
removed numpy.in1d, so it needs numpy<2. Python 3.13 has no numpy 1.x wheels,
so this path cannot run there. This is an upstream nequip/numpy-2 incompatibility,
not an abICS bug.

  • Exclude ActiveLearnNequip from the Python 3.13 CI matrix (nequip is still
    tested on Python 3.9 with all numpy variants).
  • Pin numpy<2 in install_nequip.sh (before and after the nequip stack).
  • Document the numpy<2 / no-Python-3.13 requirement for both the NequIP and
    Allegro install paths (JA/EN), and explain the nequip <0.7 cap in
    pyproject.toml, plus developer notes in the workflow and install script.

Also

  • Re-enable the Test for abICS workflow and add a workflow_dispatch trigger
    (it had been auto-disabled by GitHub).

Follow-up

Restoring numpy-2 / Python 3.13 coverage for NequIP requires migrating the abICS
nequip solver/trainer to nequip >=0.7 (a backwards-incompatible rewrite),
tracked separately.

Review

Reviewed with Codex over three rounds; converged with no remaining blockers.

🤖 Generated with Claude Code

Kazuyoshi Yoshimi and others added 2 commits June 16, 2026 18:37
find_procrank_from_Trank returned the raw np.argwhere result, a 2-D array
(shape (1, 1)). When passed as the MPI source/dest rank, mpi4py converts it
with int(); NumPy 2 rejects int() on non-0-dimensional arrays, raising
'only 0-dimensional arrays can be converted to Python scalars' and breaking
comm.Recv/Send on Python 3.13. Return a plain Python int instead, and fix the
dead 'if i is None' guard (np.argwhere never returns None) to check i.size.

Verified locally with Python 3.13 / numpy 2.4.6 / mpi4py 4.1.2: the mock,
potts and potts_pamc sampling tests and the unit tests all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The supported nequip series (<0.7) uses numpy.in1d, removed in NumPy 2, so it
needs numpy<2. Python 3.13 has no numpy 1.x wheels, so the nequip path cannot
run there. This is an upstream nequip/numpy-2 incompatibility, not an abICS bug.

- Exclude the ActiveLearnNequip CI job on Python 3.13 (with a comment)
- Note the numpy<2 / no-Python-3.13 limitation in the JA/EN nequip tutorials
- Explain the nequip <0.7 cap in pyproject.toml

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates abICS to pass CI on Python 3.13 by fixing a NumPy 2 incompatibility in RXMC replica exchange, and by documenting/skipping the NequIP integration path where upstream constraints prevent Python 3.13 support.

Changes:

  • Fix TemperatureRX_MPI.find_procrank_from_Trank to return a plain int rank (avoids NumPy 2 scalar-conversion failure during MPI send/recv).
  • Document the NequIP/Allegro numpy<2 requirement (and Python 3.13 incompatibility) and enforce numpy<2 in the NequIP install script.
  • Update the GitHub Actions matrix to skip the NequIP integration test on Python 3.13 and re-enable manual workflow runs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
abics/sampling/rxmc.py Fixes MPI rank handling under NumPy 2 by returning a scalar int from np.argwhere results.
tests/integration/active_learn_nequip/install_nequip.sh Pins numpy<2 before/after NequIP stack installation to avoid upstream NumPy 2 incompatibility.
pyproject.toml Adds developer-facing rationale for capping nequip <0.7 and its NumPy/Python constraints.
docs/sphinx/en/source/tutorial/other_models.rst Documents numpy<2 and Python 3.13 limitation for NequIP/Allegro install paths.
docs/sphinx/ja/source/tutorial/other_models.rst Same as above in Japanese docs, including numpy<2 guidance.
.github/workflows/Test_abICS.yml Skips NequIP integration on Python 3.13 and adds workflow_dispatch trigger.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 21 to 23
exclude:
- python-version: '3.13'
numpy-version: '1.20.0'
@k-yoshimi k-yoshimi merged commit 43997d7 into develop Jun 20, 2026
25 checks passed
@k-yoshimi k-yoshimi deleted the fix-python313-tests branch June 20, 2026 22:56
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.

2 participants