#1140729 siconos: mechanics-tools autopkgtest fails with AttributeError: module 'numpy' has no attribute 'in1d'

Package:
src:siconos
Source:
src:siconos
Submitter:
Ujjwal Sarswat
Date:
2026-06-25 07:35:03 UTC
Severity:
normal
Tags:
#1140729#5
Date:
2026-06-25 07:34:14 UTC
From:
To:
Dear Maintainer,

=== Forwarded from Ubuntu ===

The `mechanics-tools` autopkgtest is currently failing. The `/usr/bin/siconos_filter` script uses `numpy.in1d`, which has been deprecated and subsequently removed in recent versions of NumPy (NumPy 2.4). It needs to be replaced with `numpy.isin`.

You can view the full failure logs here:
https://autopkgtest.ubuntu.com/results/autopkgtest-stonking/stonking/amd64/s/siconos/20260622_142258_b5701@/log.gz

Relevant Traceback snippet:
----------------------------------------------------------------------
  File "/usr/bin/siconos_filter", line 118, in visitor
    time_idx = np.in1d(obj[:,0], self.times).nonzero()[0]
    ^^^^^^^
  File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 792, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute 'in1d'. Did you mean: 'int16'?
----------------------------------------------------------------------

Upstream context:
There is no need to forward this issue upstream. Upstream is currently working on major changes (currently on rc1) that entirely removes the folder and file associated with this bug.

However, since those upstream changes will take time to finalize and land, a simple interim patch replacing `np.in1d` with `np.isin` is necessary for Debian to restore the autopkgtests.
--- a/io/swig/io/filter.py
+++ b/io/swig/io/filter.py
@@ -115,7 +115,7 @@
                         time_idx = self.time_idx
                     # Time-filter all but static objects
                     elif path != 'data/static':
-                        time_idx = np.in1d(obj[:,0], self.times).nonzero()[0]
+                        time_idx = np.isin(obj[:,0], self.times).nonzero()[0]

                 # Additionally remove any lines referencing excluded objects
                 if self.excluded_objects is not None:

Thanks,
vmpyr