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

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

Open
agstephens opened this issue Jul 5, 2023 · 1 comment

Comments

@agstephens
Copy link
Member

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

@RosalynHatcher
Copy link
Contributor

Thanks @agstephens
I'll take a look when I'm back from leave next week.

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