aesara-devs / aesara

Aesara is a Python library for defining, optimizing, and efficiently evaluating mathematical expressions involving multi-dimensional arrays.
https://aesara.readthedocs.io
Other
1.18k stars 155 forks source link

NumPy 1.26 causes error #1513

Open maresb opened 1 year ago

maresb commented 1 year ago

Description of your problem or feature request

import aesara

Please provide the full tracebacks for any relevant errors and/or warning messages.

Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/site-packages/aesara/configparser.py", line 234, in fetch_val_for_key
    return self._aesara_cfg.get(section, option)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/configparser.py", line 797, in get
    d = self._unify_values(section, vars)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/configparser.py", line 1168, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'blas'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/site-packages/aesara/configparser.py", line 350, in __get__
    val_str = cls.fetch_val_for_key(self.name, delete_key=delete_key)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/aesara/configparser.py", line 238, in fetch_val_for_key
    raise KeyError(key)
KeyError: 'blas__ldflags'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.11/site-packages/aesara/__init__.py", line 120, in <module>
    from aesara import scalar, tensor
  File "/opt/conda/lib/python3.11/site-packages/aesara/tensor/__init__.py", line 106, in <module>
    from aesara.tensor import (  # noqa
  File "/opt/conda/lib/python3.11/site-packages/aesara/tensor/blas.py", line 162, in <module>
    from aesara.tensor.blas_headers import blas_header_text, blas_header_version
  File "/opt/conda/lib/python3.11/site-packages/aesara/tensor/blas_headers.py", line 1015, in <module>
    if not config.blas__ldflags:
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/aesara/configparser.py", line 354, in __get__
    val_str = self.default()
              ^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/aesara/link/c/cmodule.py", line 2725, in default_blas_ldflags
    blas_info = np.__config__.get_info("blas_opt")
                ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'numpy.__config__' has no attribute 'get_info'

Please provide any additional information below.

Versions and main components

Aesara config: Place the results of `python -c "import aesara; print(aesara.config)"` here. N/A
brandonwillard commented 1 year ago

1512 was merged recently as a fix for that specific issue, but it doesn't necessarily address all the potential issues with NumPy 1.26, since the CI tests don't cover that version yet.

maresb commented 1 year ago

Ah, very nice. I wanted to fix the feedstock and didn't check for duplicates.

brandonwillard commented 1 year ago

Ah, very nice. I wanted to fix the feedstock and didn't check for duplicates.

No problem; it's probably best to bound the version for now, as you did in the feedstock.

maresb commented 1 year ago

Ah, so to be clear <1.26 should apply also in 2.9.2?

maresb commented 1 year ago

If so, should probably be added to pyproject.toml

brandonwillard commented 1 year ago

If so, should probably be added to pyproject.toml

True. I might have time to set up the tests in CI soon, in which case bounding the version might not be necessary.