Closed konstantinstadler closed 1 year ago
The issue is reproducible across machines (and OS: linux and windows) here, it seems that older versions of brighway don't have that problem.
Hi @konstantinstadler,
Thanks for using brightway! The issue and a fix have been described here. Simply downgrade numpy: conda install numpy=1.23.5
.
Thanks a lot! We will do that. Sorry for not finding the previous one, just checked in here
Hi,
We are trying to follow the tutorial at https://github.com/brightway-lca/brightway2/blob/master/notebooks/Activities%20and%20exchanges.ipynb
after installing brighway via (which installs numpy 1.24.1)
mamba create -n bw2 -c conda-forge -c cmutel brightway2 jupyterlab
and runningwe get
In [3]: from brightway2 import * /home/konstans/.conda/envs/bw2/lib/python3.11/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 versi ons. (numpy_string('negative'), np.bool),AttributeError Traceback (most recent call last) Cell In[3], line 1 ----> 1 from brightway2 import *
File ~/.conda/envs/bw2/lib/python3.11/site-packages/brightway2/init.py:2 1 # -- coding: utf-8 - ----> 2 from bw2data import 3 from bw2calc import 4 from bw2io import *
File ~/.conda/envs/bw2/lib/python3.11/site-packages/bw2data/init.py:64 61 config.p = preferences 63 from .serialization import JsonWrapper ---> 64 from .database import DatabaseChooser as Database, get_activity 65 from .data_store import DataStore, ProcessedDataStore 66 from .method import Method
File ~/.conda/envs/bw2/lib/python3.11/site-packages/bw2data/database.py:6 3 from eight import * 5 from . import databases, config ----> 6 from .backends.single_file import SingleFileDatabase 7 from .backends.json import JSONDatabase 8 from .backends.peewee import SQLiteBackend
File ~/.conda/envs/bw2/lib/python3.11/site-packages/bw2data/backends/init.py:5 2 from future import print_function, unicode_literals 3 from eight import * ----> 5 from .base import LCIBackend 6 from .peewee import SQLiteBackend 7 from .json import JSONDatabase
File ~/.conda/envs/bw2/lib/python3.11/site-packages/bw2data/backends/base.py:12 3 from eight import * 5 from .. import ( 6 config, 7 databases, (...) 10 projects, 11 ) ---> 12 from ..data_store import ProcessedDataStore 13 from ..errors import UntypedExchange, InvalidExchange, UnknownObject 14 from ..query import Query
File ~/.conda/envs/bw2/lib/python3.11/site-packages/bw2data/data_store.py:151 147 self.validator(data) 148 return True --> 151 class ProcessedDataStore(DataStore): 152 """ 153 Brightway2 data stores that can be processed to NumPy arrays. In addition to
metadata
and (optionally)validator
, subclasses should define: 154 (...) 160 161 """ 162 dtype_fields = NoneFile ~/.conda/envs/bw2/lib/python3.11/site-packages/bw2data/data_store.py:172, in ProcessedDataStore() 162 dtype_fields = None 163 # Numpy columns names can't be unicode 164 base_uncertainty_fields = [ 165 (numpy_string('uncertainty_type'), np.uint8), 166 (numpy_string('amount'), np.float32), 167 (numpy_string('loc'), np.float32), 168 (numpy_string('scale'), np.float32), 169 (numpy_string('shape'), np.float32), 170 (numpy_string('minimum'), np.float32), 171 (numpy_string('maximum'), np.float32), --> 172 (numpy_string('negative'), np.bool), 173 ] 175 @property 176 def dtype(self): 177 """Returns both the generic
base_uncertainty_fields
plus class-specificdtype_fields
.dtype
determines the columns of the :ref:processed array <processing-data>
."""File ~/.conda/envs/bw2/lib/python3.11/site-packages/numpy/init.py:284, in getattr(attr) 281 from .testing import Tester 282 return Tester --> 284 raise AttributeError("module {!r} has no attribute " 285 "{!r}".format(name, attr))
AttributeError: module 'numpy' has no attribute 'bool'