Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around bug in pint 0.24.0 #534

Closed
khaeru opened this issue Jun 12, 2024 · 2 comments
Closed

Work around bug in pint 0.24.0 #534

khaeru opened this issue Jun 12, 2024 · 2 comments
Labels
ci Continuous integration

Comments

@khaeru
Copy link
Member

khaeru commented Jun 12, 2024

Pint 0.24.0 (released 2024-06-) triggered CI failures like this:

FAILED ixmp/tests/report/test_reporter.py::test_platform_units[attrseries] - Failed: Did not log:
    'x: replace units dimensionless with USD/pkm'
among:
    "x: mixed units ['kg', 'USD/pkm'] discarded"
    'x: replace units  with USD/pkm'

This was due to hgrecco/pint#2007 affecting this line:

log.info(
f"{name}: replace units {attrs.get('_unit', '(none)')} with {new_unit}"
)

Work-around / mitigation

  • Limit pint to < 0.24.

    At Use pint != 0.24.0 in "pytest" CI workflow #535, with pint 0.23 and NumPy 2.0.0, we see:

    File "/opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/site-packages/pint/facets/numpy/numpy_func.py", line 958, in implement_single_dimensionless_argument_func
        func = getattr(np, func_str)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/site-packages/numpy/__init__.py", line 410, in __getattr__
        raise AttributeError("module {!r} has no attribute "
    AttributeError: module 'numpy' has no attribute 'cumproduct'. Did you mean: 'cumprod'?
    

    This is mentioned at pint 0.24 / numpy 2.0 / python 3.9 issues hgrecco/pint#1974 (comment).

    Because of this (but for no other reason, i.e. no issue inherent to ixmp), the mitigation also requires to limit NumPy < 2.

Fix

  • It seems pint 0.24.1 will shortly be released and will reverse the change.
    Wait for the release, confirm the fix, remove the work-around, and close this issue.
@khaeru khaeru added the ci Continuous integration label Jun 12, 2024
@khaeru
Copy link
Member Author

khaeru commented Jun 13, 2024

This also affects message-ix-models (see here), so the same work-around could be applied. message_ix is not affected.

@glatterf42
Copy link
Member

This was closed in #544.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration
Projects
None yet
Development

No branches or pull requests

2 participants