Fix Python 3.13 test failures (RXMC NumPy 2 bug; document/skip NequIP)#81
Merged
Conversation
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>
There was a problem hiding this comment.
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_Trankto return a plainintrank (avoids NumPy 2 scalar-conversion failure during MPI send/recv). - Document the NequIP/Allegro
numpy<2requirement (and Python 3.13 incompatibility) and enforcenumpy<2in 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Make the test suite pass on Python 3.13. The
Test for abICSworkflow had beenauto-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
developdirectly.1. RXMC replica exchange crash under NumPy 2 (real bug — fixed)
abics/sampling/rxmc.py::find_procrank_from_Trankreturned the rawnp.argwhere(...)result — a 2-D array of shape(1, 1)— which was then passedas the MPI source/dest rank to
comm.Recv/comm.Send. NumPy 2 rejectsint()on a non-0-dimensional array, raising
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 deadif i is Noneguard(
np.argwherenever returnsNone) toif i.size == 0.Reproduced and verified locally with Python 3.13 / numpy 2.4.6 / mpi4py 4.1.2:
the
mock,potts, andpotts_pamcsampling 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 inpyproject.toml) calls theremoved
numpy.in1d, so it needsnumpy<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.
ActiveLearnNequipfrom the Python 3.13 CI matrix (nequip is stilltested on Python 3.9 with all numpy variants).
numpy<2ininstall_nequip.sh(before and after the nequip stack).numpy<2/ no-Python-3.13 requirement for both the NequIP andAllegro install paths (JA/EN), and explain the nequip
<0.7cap inpyproject.toml, plus developer notes in the workflow and install script.Also
Test for abICSworkflow and add aworkflow_dispatchtrigger(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