zerothi / sisl

Electronic structure Python package for post analysis and large scale tight-binding DFT/NEGF calculations
https://zerothi.github.io/sisl
Mozilla Public License 2.0
182 stars 58 forks source link

#496 seems broken on 3.12 #800

Closed zerothi closed 3 months ago

zerothi commented 3 months ago

Describe the bug CI keeps failing on 3.12, see here: https://github.com/zerothi/sisl/actions/runs/9668074708/job/26671404451

It is

 @pytest.mark.parametrize("ncoeffs", [1, 2])
    def test_orbital_products_onthefly_reduction(geometry, psi_values, ncoeffs):
        """Checks that the on the fly reduction produces the same

test that keeps failing for python 3.12 (other versions succeed). I got this from the run:

# for building
2024-06-25T18:58:27.6522224Z   Successfully installed Cython-3.0.10 numpy-1.26.2 oldest-supported-numpy-2023.12.21 packaging-24.1 pathspec-0.12.1 scikit-build-core-0.9.6 setuptools-70.1.1 setuptools_scm-8.1.0
# for running tests
2024-06-25T19:00:53.6870872Z Successfully installed ase-3.23.0 certifi-2024.6.2 cftime-1.6.4 contourpy-1.2.1 coverage-7.5.4 cycler-0.12.1 dill-0.3.8 fonttools-4.53.0 imageio-2.34.2 iniconfig-2.0.0 kiwisolver-1.4.5 lazy-loader-0.4 matplotlib-3.9.0 multiprocess-0.70.16 netCDF4-1.7.1.post1 networkx-3.3 nodify-0.0.11 numpy-1.26.4 packaging-24.1 pandas-2.2.2 pathos-0.3.2 pillow-10.3.0 plotly-5.22.0 pluggy-1.5.0 pox-0.3.4 ppft-1.7.6.8 pyparsing-3.1.2 pytest-8.2.2 pytest-cov-5.0.0 pytest-env-1.1.3 pytest-faulthandler-2.0.1 python-dateutil-2.9.0.post0 pytz-2024.1 scikit-image-0.24.0 scipy-1.14.0 sisl-0.1.dev1+g67074d9 six-1.16.0 tenacity-8.4.2 tifffile-2024.6.18 tzdata-2024.1 xarray-2024.6.0

It simply fails with this:

 if ncoeffs == 1:
>           assert np.allclose(reduced.grid, post_reduced.grid)
E           assert False
E            +  where False = <function allclose at 0x7f867b5a5eb0>(array([[[0.05123885],\n        [0.05118202],\n        [0.05036767],\n        [0.04926379],\n        [0.04840158],\n        ...66358],\n        [0.02810453],\n        [0.02864534],\n        [0.03049472],\n        [0.03366761],\n        [0.03710781]]]), array([[[0.05123885],\n        [0.05118202],\n        [0.05036767],\n        [0.04926379],\n        [0.04840158],\n        ...66358],\n        [0.02810453],\n        [0.02864534],\n        [0.03049472],\n        [0.03366761],\n        [0.03710781]]]))
E            +    where <function allclose at 0x7f867b5a5eb0> = np.allclose
E            +    and   array([[[0.05123885],\n        [0.05118202],\n        [0.05036767],\n        [0.04926379],\n        [0.04840158],\n        ...66358],\n        [0.02810453],\n        [0.02864534],\n        [0.03049472],\n        [0.03366761],\n        [0.03710781]]]) = <sisl.Grid object at 0x7f86544a6660>.grid
E            +    and   array([[[0.05123885],\n        [0.05118202],\n        [0.05036767],\n        [0.04926379],\n        [0.04840158],\n        ...66358],\n        [0.02810453],\n        [0.02864534],\n        [0.03049472],\n        [0.03366761],\n        [0.03710781]]]) = <sisl.Grid object at 0x7f865465f3b0>.grid
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/sisl/tests/test_sparse_grid.py:277: AssertionError
=============================== warnings s

@pfebrer do you have any clue?

pfebrer commented 3 months ago

The two arrays seem to really be allclose no? Maybe it's just a matter of increasing the tolerance a little bit?

zerothi commented 3 months ago

Yeah, that would make sense, we should check what the diff is in the other versions, that might give a hint.

zerothi commented 3 months ago

fixed by reducing tolerance, the 3.11 installation did'nt show anything...