Ribasim icon indicating copy to clipboard operation
Ribasim copied to clipboard

Python macOS intermittent CI failure

Open visr opened this issue 1 year ago • 3 comments

This happens somewhat regularly, that somehow the shape of a dataframe is different sometimes on macOS:

FAILED python/ribasim/tests/test_io.py::test_roundtrip - pydantic_core._pydantic_core.ValidationError: 1 validation error for Model
  Value error, Shape of passed values is (3, 5), indices imply (65536, 5) [type=value_error, input_value={'df':                   ...  <NA>  POINT (500 200)}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
= 1 failed, 50 passed, 1 skipped, 1 xfailed, 1 xpassed, 15 warnings in 27.00s ==

See for instance https://github.com/Deltares/Ribasim/actions/runs/12181851140/job/33979441871?pr=1959.

visr avatar Dec 05 '24 14:12 visr

I saw this again on the NodeTable today (with empty init), again indicating that indices imply 65536 (max of uint16). The second run crashed (one worker), the third run worked like a charm. Not sure where this comes from.

evetion avatar Jan 30 '25 16:01 evetion

I am not sure if this is the same root cause but now manifests differently, but on recent PRs we intermittently get a different error on macOS Python tests: https://github.com/Deltares/Ribasim/actions/runs/13900005591/job/38889215120?pr=2153

This may be related to the major downgrade of pyarrow on macOS in https://github.com/Deltares/Ribasim/pull/2117.

def test_migration(migration, basic, tmp_path):
        toml_path = tmp_path / "basic.toml"
        db_path = tmp_path / "database.gpkg"
        basic.write(toml_path)
    
        # Migration is not needed on default model
>       Model.read(toml_path)

python/ribasim/tests/test_schemas.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
python/ribasim/ribasim/model.py:294: in read
    return cls(filepath=filepath)  # type: ignore
python/ribasim/ribasim/input_base.py:221: in _check_filepath
    data = cls._load(filepath)
python/ribasim/ribasim/input_base.py:378: in _load
    ddf = cls._from_db(db, cls.tablename())
python/ribasim/ribasim/input_base.py:518: in _from_db
    df = gpd.read_file(
.pixi/envs/py311/lib/python3.11/site-packages/geopandas/io/file.py:294: in _read_file
    return _read_file_pyogrio(
.pixi/envs/py311/lib/python3.11/site-packages/geopandas/io/file.py:547: in _read_file_pyogrio
    return pyogrio.read_dataframe(path_or_bytes, bbox=bbox, **kwargs)
.pixi/envs/py311/lib/python3.11/site-packages/pyogrio/geopandas.py:307: in read_dataframe
    wkb_values = wkb_values.to_numpy(na_value=None)
.pixi/envs/py311/lib/python3.11/site-packages/pandas/core/base.py:637: in to_numpy
    return self.array.to_numpy(dtype, copy=copy, na_value=na_value, **kwargs)
.pixi/envs/py311/lib/python3.11/site-packages/pandas/core/arrays/arrow/array.py:1[39](https://github.com/Deltares/Ribasim/actions/runs/13900005591/job/38889215120?pr=2153#step:4:40)9: in to_numpy
    result = data._pa_array.to_numpy()
pyarrow/table.pxi:510: in pyarrow.lib.ChunkedArray.to_numpy
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   pyarrow.lib.ArrowException: Unknown error: Wrapping                                                                                                                                                                                                                                                                                                                                                  failed

visr avatar Mar 17 '25 20:03 visr

With #2154 the ArrowException has made place again for the shape mismatch. https://github.com/Deltares/Ribasim/actions/runs/13921007502/job/38954040822?pr=2156

visr avatar Mar 18 '25 11:03 visr