domeckert / pyproffit

Pyproffit is a Python code for the analysis of X-ray brightness profiles from clusters of galaxies
GNU General Public License v3.0
18 stars 4 forks source link

Import pyproffit fails for numpy 1.26 #26

Open jdeplaa opened 3 months ago

jdeplaa commented 3 months ago

Dear @domeckert,

When I install pyproffit in an environment with numpy version 1.26.4, which is the default these days, I get the following error when the module is imported.

>>> import pyproffit
Traceback (most recent call last):
  File "pytensor/configparser.py", line 201, in fetch_val_for_key
    return self._pytensor_cfg.get(section, option)
  File "lib/python3.10/configparser.py", line 783, in get
    d = self._unify_values(section, vars)
  File "python3.10/configparser.py", line 1154, 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 "pytensor/configparser.py", line 317, in __get__
    val_str = cls.fetch_val_for_key(self.name, delete_key=delete_key)
  File "pytensor/configparser.py", line 205, 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 "/pyproffit/validation/test_script.py", line 1, in <module>
    import pyproffit
  File "pyproffit-0.8-py3.10.egg/pyproffit/__init__.py", line 6, in <module>
  File "pyproffit-0.8-py3.10.egg/pyproffit/models.py", line 2, in <module>
  File "pymc/__init__.py", line 47, in <module>
    __set_compiler_flags()
  File "pymc/__init__.py", line 30, in __set_compiler_flags
    import pytensor
  File "pytensor/__init__.py", line 119, in <module>
    from pytensor import scalar, tensor
  File "pytensor/tensor/__init__.py", line 106, in <module>
    from pytensor.tensor import (  # noqa
  File "pytensor/tensor/blas.py", line 102, in <module>
    from pytensor.tensor.blas_headers import blas_header_text, blas_header_version
  File "pytensor/tensor/blas_headers.py", line 1015, in <module>
    if not config.blas__ldflags:
  File "pytensor/configparser.py", line 321, in __get__
    val_str = self.default()
  File "pytensor/link/c/cmodule.py", line 2720, in default_blas_ldflags
    blas_info = np.__config__.get_info("blas_opt")
AttributeError: module 'numpy.__config__' has no attribute 'get_info'

This issue does not occur when numpy is downgraded to version 1.24. Looks like an issue somewhere in the dependency tree.

Thanks!

domeckert commented 3 months ago

Thanks for the report @jdeplaa . As you're saying this looks like an upstream issue, i.e. an incompatibility between pytensor and numpy. I'll try to reproduce the error and if necessary, will report a bug to the pytensor people.