Import aesara fails with numpy 1.26
oscarbenjamin opened this issue · comments
Oscar Benjamin commented
This is showing up in SymPy's CI but only for Python 3.11.
$ python3.11 -m venv venv
$ source venv/bin/activate
$ pip install numpy aesara
...
Successfully installed aesara-2.9.1 cons-0.4.6 etuples-0.3.9 filelock-3.12.4 logical-unification-0.4.6 minikanren-1.0.3 multipledispatch-1.0.0 numpy-1.26.0 scipy-1.11.2 toolz-0.12.0 typing-extensions-4.8.0
$ python -c 'import aesara'
Traceback (most recent call last):
File "/home/oscar/current/active/sympy/tmp/venv/lib/python3.11/site-packages/aesara/configparser.py", line 234, in fetch_val_for_key
return self._aesara_cfg.get(section, option)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.11.3/lib/python3.11/configparser.py", line 797, in get
d = self._unify_values(section, vars)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.11.3/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 "/home/oscar/current/active/sympy/tmp/venv/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 "/home/oscar/current/active/sympy/tmp/venv/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 "<string>", line 1, in <module>
File "/home/oscar/current/active/sympy/tmp/venv/lib/python3.11/site-packages/aesara/__init__.py", line 120, in <module>
from aesara import scalar, tensor
File "/home/oscar/current/active/sympy/tmp/venv/lib/python3.11/site-packages/aesara/tensor/__init__.py", line 106, in <module>
from aesara.tensor import ( # noqa
File "/home/oscar/current/active/sympy/tmp/venv/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 "/home/oscar/current/active/sympy/tmp/venv/lib/python3.11/site-packages/aesara/tensor/blas_headers.py", line 1015, in <module>
if not config.blas__ldflags:
^^^^^^^^^^^^^^^^^^^^
File "/home/oscar/current/active/sympy/tmp/venv/lib/python3.11/site-packages/aesara/configparser.py", line 354, in __get__
val_str = self.default()
^^^^^^^^^^^^^^
File "/home/oscar/current/active/sympy/tmp/venv/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'
The problem is caused by the release of numpy 1.26.0 two days ago.
Downgrading numpy fixes the problem:
$ pip install 'numpy<1.26'
...
Successfully installed numpy-1.25.2
$ python -c 'import aesara'
WARNING (aesara.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
Oscar Benjamin commented
Thanks!
Brandon T. Willard commented
Thanks!
Any time. I'll create a new release once #1509 is done.