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

BUG: using numpy code that has been deprecated in v1.26.0 #441

Closed
jpreszler opened this issue Sep 17, 2023 · 4 comments · Fixed by #444
Closed

BUG: using numpy code that has been deprecated in v1.26.0 #441

jpreszler opened this issue Sep 17, 2023 · 4 comments · Fixed by #444
Labels
bug Something isn't working release

Comments

@jpreszler
Copy link

Describe the issue:

Numpy v1.26.0 was released on Sept. 16, 2023. It no longer has a get_info() method inside numpy.config which is used https://github.com/pymc-devs/pytensor/blob/main/pytensor/link/c/cmodule.py#L2720. This causes package import to fail because pytensor doesn't have a upper limit on the version of numpy that can be loaded.

Reproducable code example:

# with numpy 1.26.0
import pytensor

Error message:

import pytensor
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pytensor/__init__.py:119: in <module>
    from pytensor import scalar, tensor
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pytensor/tensor/__init__.py:106: in <module>
    from pytensor.tensor import (  # noqa
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pytensor/tensor/blas.py:102: in <module>
    from pytensor.tensor.blas_headers import blas_header_text, blas_header_version
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pytensor/tensor/blas_headers.py:1015: in <module>
    if not config.blas__ldflags:
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pytensor/configparser.py:321: in __get__
    val_str = self.default()
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pytensor/link/c/cmodule.py:2720: in default_blas_ldflags
    blas_info = np.__config__.get_info("blas_opt")
E   AttributeError: module 'numpy.__config__' has no attribute 'get_info'
Error: Process completed with exit code 4.

PyTensor version information:

pytensor v2.16.1

Context for the issue:

No response

@maresb
Copy link
Contributor

maresb commented Sep 21, 2023

While we have not yet solved the compatibility of PyTensor and NumPy v1.26.0, we have constrained our conda-forge packages so that new environments should enforce NumPy with <1.26.0, preventing the error from occurring.

@brendan-m-murphy
Copy link

brendan-m-murphy commented Sep 28, 2023

I get the same error if I compile numpy 1.25.2 using meson. (I think numpy 1.26 uses the meson build by default.)

In the meson build of numpy 1.25.2, the __config__.py file is a different style and doesn't have a get_info function. So this isn't really 1.26 vs 1.25, it's meson vs. the old build process.

@johannes-mueller
Copy link

While we have not yet solved the compatibility of PyTensor and NumPy v1.26.0, we have constrained our conda-forge packages so that new environments should enforce NumPy with <1.26.0, preventing the error from occurring.

That has the disadvantage that pytensor seems not to be installable for Python 3.12 as numpy<1.26 seems not to be installable on Python 3.12

@ricardoV94
Copy link
Member

ricardoV94 commented Oct 9, 2023

PyTensor is explicitly not yet supported (nor tested) in Python 3.12

maresb added a commit that referenced this issue Oct 9, 2023
To discuss: If we don't support 3.12, maybe we should enforce this here in `pyproject.toml`?

Source: <#441 (comment)>

I'm not convinced that this is the right move since it might slightly hinder testing. But if we are explicit, then this seems to me like the correct place for it.
maresb added a commit that referenced this issue Oct 9, 2023
To discuss: If we don't support 3.12, maybe we should enforce this here in `pyproject.toml`?

Source: <#441 (comment)>

I'm not convinced that this is the right move since it might slightly hinder testing. But if we are explicit, then this seems to me like the correct place for it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants