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

Import aesara fails with numpy 2.0.dev #1526

Open
oscarbenjamin opened this issue Jan 23, 2024 · 1 comment
Open

Import aesara fails with numpy 2.0.dev #1526

oscarbenjamin opened this issue Jan 23, 2024 · 1 comment

Comments

@oscarbenjamin
Copy link

Description of your problem or feature request

I found this while investigating sympy/sympy#26094.

With the numpy nightly builds for upcoming numpy 2.0 Aesara fails to import. Looks like it might be an easy fix though from the suggestion in the error message.

The nightly build can be installed with:

pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy

Demonstration:

>>> import aesara
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/oscar/.pyenv/versions/sympy-3.11.git/lib/python3.11/site-packages/aesara/__init__.py", line 120, in <module>
    from aesara import scalar, tensor
  File "/home/oscar/.pyenv/versions/sympy-3.11.git/lib/python3.11/site-packages/aesara/tensor/__init__.py", line 105, in <module>
    from aesara.tensor import sharedvar  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oscar/.pyenv/versions/sympy-3.11.git/lib/python3.11/site-packages/aesara/tensor/sharedvar.py", line 8, in <module>
    from aesara.tensor.type import TensorType
  File "/home/oscar/.pyenv/versions/sympy-3.11.git/lib/python3.11/site-packages/aesara/tensor/type.py", line 787, in <module>
    cscalar = TensorType("complex64", ())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oscar/.pyenv/versions/sympy-3.11.git/lib/python3.11/site-packages/aesara/tensor/type.py", line 104, in __init__
    if np.obj2sctype(dtype) is None:
       ^^^^^^^^^^^^^
  File "/home/oscar/.pyenv/versions/sympy-3.11.git/lib/python3.11/site-packages/numpy/__init__.py", line 396, in __getattr__
    raise AttributeError(
AttributeError: `np.obj2sctype` was removed in the NumPy 2.0 release. Use `np.dtype(obj).type` instead.
@oscarbenjamin oscarbenjamin changed the title Import aesara files with numpy 2.0.dev Import aesara fails with numpy 2.0.dev Jan 24, 2024
@brandonwillard
Copy link
Member

Thanks for the heads-up!

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

No branches or pull requests

2 participants