brightway-lca / brightway2

Metapackage for brightway2 imports and documentation
https://brightway.dev/
BSD 3-Clause "New" or "Revised" License
100 stars 37 forks source link

numpy.bool is deprecated and is removed from numpy-1.24.x #64

Open gschwind opened 1 year ago

gschwind commented 1 year ago

Hello,

Message shown when using numpy-1.23.3:

<stdin>:1: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
<class 'bool'>

With numpy-1.24.1 brightway2 does not import:

/lib/python3.9/site-packages/bw2data/data_store.py:172: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.  (This may have returned Python scalars in past versions.
  (numpy_string('negative'), np.bool),
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/python3.9/site-packages/brightway2/__init__.py", line 2, in <module>
    from bw2data import *
  File "/lib/python3.9/site-packages/bw2data/__init__.py", line 64, in <module>
    from .database import DatabaseChooser as Database, get_activity
  File "/lib/python3.9/site-packages/bw2data/database.py", line 6, in <module>
    from .backends.single_file import SingleFileDatabase
  File "/lib/python3.9/site-packages/bw2data/backends/__init__.py", line 5, in <module>
    from .base import LCIBackend
  File "/lib/python3.9/site-packages/bw2data/backends/base.py", line 12, in <module>
    from ..data_store import ProcessedDataStore
  File "/lib/python3.9/site-packages/bw2data/data_store.py", line 151, in <module>
    class ProcessedDataStore(DataStore):
  File "/lib/python3.9/site-packages/bw2data/data_store.py", line 172, in ProcessedDataStore
    (numpy_string('negative'), np.bool),
  File "/lib/python3.9/site-packages/numpy/__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'bool'

Best regards

tfardet commented 1 year ago

Fixed in this PR