Skip to content

Numpy version compatibility error: AttributeError: module 'numpy' has no attribute 'bool'. #108

@agstephens

Description

@agstephens

Hi @RosalynHatcher, on one of the JASMIN installations of the cfchecker, we saw this error:

(ingest_py3) [badc@ingest4 ~]$ cfchecks /badc/ecmwf-era-interim/data/gg/as/2019/01/01/ggas201901010000.nc
CHECKING NetCDF FILE: /badc/ecmwf-era-interim/data/gg/as/2019/01/01/ggas201901010000.nc
=====================
Using CF Checker Version 4.1.0
Checking against CF Version CF-1.8
Using Standard Name Table Version 81 (2023-04-25T10:43:33Z)
Using Area Type Table Version 10 (23 June 2020)
Using Standardized Region Name Table Version 4 (18 December 2018)

WARN: (2.6.1): No 'Conventions' attribute present

------------------
Checking variable: longitude
------------------
Traceback (most recent call last):
  File "/home/badc/miniconda3/envs/ingest_py3/bin/cfchecks", line 8, in <module>
    sys.exit(main())
  File "/home/badc/miniconda3/envs/ingest_py3/lib/python3.8/site-packages/cfchecker/cfchecks.py", line 3402, in main
    inst.checker(file)
  File "/home/badc/miniconda3/envs/ingest_py3/lib/python3.8/site-packages/cfchecker/cfchecks.py", line 531, in checker
    return self._checker()
  File "/home/badc/miniconda3/envs/ingest_py3/lib/python3.8/site-packages/cfchecker/cfchecks.py", line 814, in _checker
    self.chkValuesMonotonic(var)
  File "/home/badc/miniconda3/envs/ingest_py3/lib/python3.8/site-packages/cfchecker/cfchecks.py", line 3257, in chkValuesMonotonic
    values = self.f.variables[varName][:]
  File "netCDF4/_netCDF4.pyx", line 4492, in netCDF4._netCDF4.Variable.__getitem__
  File "netCDF4/_netCDF4.pyx", line 4559, in netCDF4._netCDF4.Variable._toma
  File "/home/badc/miniconda3/envs/ingest_py3/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any be scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

This version of numpy works fine: 1.22.4
This version of numpy was incompatible: 1.24.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions