Closed SELTENEERDEN closed 5 months ago
Hey, thanks a lot for sharing this. That seems like something is going very wrong. Could you please give your environment data?
You can do that by writing the following in the terminal (black screen with white text):
conda activate ab
(if you had not done so already)conda list
This will give you a long list of libraries Activity Browser uses, that list will help us understand your problem.
Hi Marc, thx for your quick answer. Here is the environment data
(base) C:\Windows\system32>activate ab
(ab) C:\Windows\system32>activity-browser
-hiding tab:History
DevTools listening on ws://127.0.0.1:3999/devtools/browser/0b5ad34e-9e71-4795-a6f4-2347043b2797
-hiding tab:Activity Details
-hiding tab:Characterization Factors
-hiding tab:Graph Explorer
-hiding tab:LCA results
The Activity Browser log file can be found at C:\Users\benif\AppData\Local\ActivityBrowser\ActivityBrowser\Logs\ab_logs-2024-1-15_19-32-20.log
Activity Browser version: 2.9.4
Loading user settings:
dirpath already loaded
Reset project settings directory to:C:\Users\benif\AppData\Local\pylca\Brightway3\default.c21f969b5f03d33d43e04f8f136e7682
Loaded project:default
Brightway2 data directory: C:\Users\benif\AppData\Local\pylca\Brightway3
Brightway2 active project: default
Qt Version:5.15.8
Remote debugging server started successfully. Try pointing a Chromium-based browser to http://127.0.0.1:3999
Current shape and databases in the MetaDataStore:(0, 0)set()
Adding:Kevitsa
Traceback (most recent call last):
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\activity.py", line 64, in safe_open_activity_tab
self.open_activity_tab(key)
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\activity.py", line 41, in open_activity_tab
new_tab = ActivityTab(key, read_only=read_only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\activity.py", line 181, in __init__
self.populate()
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\activity.py", line 216, in populate
self.production.model.sync(self.activity.production())
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\ui\tables\models\activity.py", line 46, in sync
self._dataframe = pd.DataFrame([
^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\ui\tables\models\activity.py", line 46, in <listcomp>
self._dataframe = pd.DataFrame([
^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\ui\tables\models\activity.py", line 45, in <genexpr>
data = (self.create_row(exc) for exc in self.exchanges)
^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\ui\tables\models\activity.py", line 218, in create_row
row = super().create_row(exchange)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\ui\tables\models\activity.py", line 61, in create_row
"Amount": float(exchange.get("amount", 1)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'tuple'
(ab) C:\Windows\system32>conda conda
usage: conda-script.py [-h] [-v] [--no-plugins] [-V] COMMAND ...
conda-script.py: error: argument COMMAND: invalid choice: 'conda' (choose from 'activate', 'deactivate', 'clean', 'compare', 'config', 'create', 'info', 'init', 'install', 'list', 'notices', 'package', 'remove', 'uninstall', 'rename', 'run', 'search', 'update', 'upgrade', 'content-trust', 'doctor', 'repoquery', 'env')
(ab) C:\Windows\system32>
(ab) C:\Windows\system32>
(ab) C:\Windows\system32>conda list
# packages in environment at C:\ProgramData\miniconda3\envs\ab:
#
# Name Version Build Channel
activity-browser 2.9.4 pyhd8ed1ab_0 conda-forge
appdirs 1.4.4 pyh9f0ad1d_0 conda-forge
arrow 1.3.0 pyhd8ed1ab_0 conda-forge
asteval 0.9.31 pyhd8ed1ab_0 conda-forge
astunparse 1.6.3 pyhd8ed1ab_0 conda-forge
blinker 1.7.0 pyhd8ed1ab_0 conda-forge
brightway2 2.4.4 pyhd8ed1ab_0 conda-forge
brotli 1.1.0 hcfcfb64_1 conda-forge
brotli-bin 1.1.0 hcfcfb64_1 conda-forge
brotli-python 1.1.0 py311h12c1d0e_1 conda-forge
brotlicffi 1.1.0.0 py311h12c1d0e_1 conda-forge
bw2analyzer 0.10 pyhd8ed1ab_0 conda-forge
bw2calc 1.8.2 py311h1ea47a8_0 conda-forge
bw2data 3.6.6 pyhd8ed1ab_0 conda-forge
bw2io 0.8.10 pyhd8ed1ab_0 conda-forge
bw2parameters 1.1.0 pyhd8ed1ab_0 conda-forge
bw_migrations 0.2 pyhd8ed1ab_0 conda-forge
bzip2 1.0.8 hcfcfb64_5 conda-forge
ca-certificates 2023.11.17 h56e8100_0 conda-forge
certifi 2023.11.17 pyhd8ed1ab_0 conda-forge
cffi 1.16.0 py311ha68e1ae_0 conda-forge
charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge
click 8.1.7 win_pyh7428d3b_0 conda-forge
colorama 0.4.6 pyhd8ed1ab_0 conda-forge
contourpy 1.2.0 py311h005e61a_0 conda-forge
cycler 0.12.1 pyhd8ed1ab_0 conda-forge
dill 0.3.7 pyhd8ed1ab_0 conda-forge
docopt 0.6.2 py_1 conda-forge
eidl 2.0.1 pyhd8ed1ab_0 conda-forge
eight 1.0.1 pyhd8ed1ab_4 conda-forge
et_xmlfile 1.1.0 pyhd8ed1ab_0 conda-forge
fasteners 0.17.3 pyhd8ed1ab_0 conda-forge
flask 3.0.0 pyhd8ed1ab_0 conda-forge
fonttools 4.47.2 py311ha68e1ae_0 conda-forge
freetype 2.12.1 hdaf720e_2 conda-forge
future 0.18.3 pyhd8ed1ab_0 conda-forge
gettext 0.21.1 h5728263_0 conda-forge
glib 2.78.3 h12be248_0 conda-forge
glib-tools 2.78.3 h12be248_0 conda-forge
gst-plugins-base 1.22.8 h001b923_1 conda-forge
gstreamer 1.22.8 hb4038d2_1 conda-forge
icu 73.2 h63175ca_0 conda-forge
idna 3.6 pyhd8ed1ab_0 conda-forge
importlib-metadata 7.0.1 pyha770c72_0 conda-forge
importlib_metadata 7.0.1 hd8ed1ab_0 conda-forge
inflate64 1.0.0 py311ha68e1ae_0 conda-forge
intel-openmp 2023.2.0 h57928b3_50497 conda-forge
itsdangerous 2.1.2 pyhd8ed1ab_0 conda-forge
jinja2 3.1.3 pyhd8ed1ab_0 conda-forge
kiwisolver 1.4.5 py311h005e61a_1 conda-forge
krb5 1.21.2 heb0366b_0 conda-forge
lcms2 2.16 h67d730c_0 conda-forge
lerc 4.0.0 h63175ca_0 conda-forge
libblas 3.9.0 20_win64_mkl conda-forge
libbrotlicommon 1.1.0 hcfcfb64_1 conda-forge
libbrotlidec 1.1.0 hcfcfb64_1 conda-forge
libbrotlienc 1.1.0 hcfcfb64_1 conda-forge
libcblas 3.9.0 20_win64_mkl conda-forge
libclang 15.0.7 default_h77d9078_3 conda-forge
libclang13 15.0.7 default_h77d9078_3 conda-forge
libdeflate 1.19 hcfcfb64_0 conda-forge
libffi 3.4.2 h8ffe710_5 conda-forge
libglib 2.78.3 h16e383f_0 conda-forge
libhwloc 2.9.1 h51c2c0f_0 conda-forge
libiconv 1.17 hcfcfb64_2 conda-forge
libjpeg-turbo 3.0.0 hcfcfb64_1 conda-forge
liblapack 3.9.0 20_win64_mkl conda-forge
libogg 1.3.4 h8ffe710_1 conda-forge
libpng 1.6.39 h19919ed_0 conda-forge
libsqlite 3.44.2 hcfcfb64_0 conda-forge
libtiff 4.6.0 h6e2ebb7_2 conda-forge
libvorbis 1.3.7 h0e60522_0 conda-forge
libwebp 1.3.2 hcfcfb64_1 conda-forge
libwebp-base 1.3.2 hcfcfb64_0 conda-forge
libxcb 1.15 hcd874cb_0 conda-forge
libxml2 2.10.4 hc3477c8_0 conda-forge
libxslt 1.1.37 h0192164_0 conda-forge
libzlib 1.2.13 hcfcfb64_5 conda-forge
lxml 4.9.2 py311h5942461_0 conda-forge
m2w64-gcc-libgfortran 5.3.0 6 conda-forge
m2w64-gcc-libs 5.3.0 7 conda-forge
m2w64-gcc-libs-core 5.3.0 7 conda-forge
m2w64-gmp 6.1.0 2 conda-forge
m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge
markupsafe 2.1.3 py311ha68e1ae_1 conda-forge
matplotlib-base 3.8.2 py311h6e989c2_0 conda-forge
mkl 2023.2.0 h6a75c08_50497 conda-forge
mrio_common_metadata 0.2.1 pyhd8ed1ab_0 conda-forge
msys2-conda-epoch 20160418 1 conda-forge
multiprocess 0.70.15 py311ha68e1ae_1 conda-forge
multivolumefile 0.2.3 pyhd8ed1ab_0 conda-forge
munkres 1.1.4 pyh9f0ad1d_0 conda-forge
networkx 3.2.1 pyhd8ed1ab_0 conda-forge
numpy 1.23.5 py311h95d790f_0 conda-forge
openjpeg 2.5.0 h3d672ee_3 conda-forge
openpyxl 3.1.2 py311ha68e1ae_1 conda-forge
openssl 3.2.0 hcfcfb64_1 conda-forge
packaging 23.2 pyhd8ed1ab_0 conda-forge
pandas 2.1.4 py311hf63dbb6_0 conda-forge
pathos 0.3.1 pyhd8ed1ab_0 conda-forge
patsy 0.5.6 pyhd8ed1ab_0 conda-forge
pcre2 10.42 h17e33f8_0 conda-forge
peewee 3.17.0 py311had142b2_0 conda-forge
pillow 10.2.0 py311h4dd8a23_0 conda-forge
pint 0.21 pyhd8ed1ab_0 conda-forge
pip 23.3.2 pyhd8ed1ab_0 conda-forge
pox 0.3.3 pyhd8ed1ab_0 conda-forge
ppft 1.7.6.7 pyhd8ed1ab_0 conda-forge
psutil 5.9.7 py311ha68e1ae_0 conda-forge
pthread-stubs 0.4 hcd874cb_1001 conda-forge
pthreads-win32 2.9.1 hfa6e2cd_3 conda-forge
py7zr 0.20.8 pyhd8ed1ab_1 conda-forge
pybcj 1.0.2 py311ha68e1ae_0 conda-forge
pycparser 2.21 pyhd8ed1ab_0 conda-forge
pycryptodomex 3.19.0 py311ha68e1ae_1 conda-forge
pypardiso 0.4.3 pyhd8ed1ab_0 conda-forge
pyparsing 3.1.1 pyhd8ed1ab_0 conda-forge
pyperclip 1.8.2 pyhd8ed1ab_2 conda-forge
pyppmd 1.1.0 py311h12c1d0e_0 conda-forge
pyprind 2.11.2 py311h1ea47a8_1005 conda-forge
pyside2 5.15.8 py311h2411a93_2 conda-forge
pysocks 1.7.1 pyh0701188_6 conda-forge
python 3.11.0 hcf16a7b_0_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-tzdata 2023.4 pyhd8ed1ab_0 conda-forge
python_abi 3.11 4_cp311 conda-forge
pytz 2023.3.post1 pyhd8ed1ab_0 conda-forge
pyxlsb 1.0.10 pyhd8ed1ab_0 conda-forge
pyzstd 0.15.9 py311he5d195f_1 conda-forge
qt-main 5.15.8 h9e85ed6_18 conda-forge
qt-webengine 5.15.8 h4bf5c4e_4 conda-forge
requests 2.31.0 pyhd8ed1ab_0 conda-forge
salib 1.4.7 pyhd8ed1ab_0 conda-forge
scipy 1.11.4 py311h0b4df5a_0 conda-forge
seaborn 0.13.1 hd8ed1ab_0 conda-forge
seaborn-base 0.13.1 pyhd8ed1ab_0 conda-forge
setuptools 69.0.3 pyhd8ed1ab_0 conda-forge
setuptools-scm 8.0.4 pyhd8ed1ab_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
stats_arrays 0.6.6 pyhd8ed1ab_0 conda-forge
statsmodels 0.14.1 py311h59ca53f_0 conda-forge
tabulate 0.9.0 pyhd8ed1ab_1 conda-forge
tbb 2021.9.0 h91493d7_0 conda-forge
texttable 1.7.0 pyhd8ed1ab_0 conda-forge
tk 8.6.13 h5226925_1 conda-forge
tomli 2.0.1 pyhd8ed1ab_0 conda-forge
tqdm 4.66.1 pyhd8ed1ab_0 conda-forge
types-python-dateutil 2.8.19.20240106 pyhd8ed1ab_0 conda-forge
typing-extensions 4.9.0 hd8ed1ab_0 conda-forge
typing_extensions 4.9.0 pyha770c72_0 conda-forge
tzdata 2023d h0c530f3_0 conda-forge
ucrt 10.0.22621.0 h57928b3_0 conda-forge
unicodecsv 0.14.1 pyhd8ed1ab_2 conda-forge
unidecode 1.3.8 pyhd8ed1ab_0 conda-forge
urllib3 2.1.0 pyhd8ed1ab_0 conda-forge
vc 14.3 hcf57466_18 conda-forge
vc14_runtime 14.38.33130 h82b7239_18 conda-forge
voluptuous 0.14.1 pyhd8ed1ab_0 conda-forge
vs2015_runtime 14.38.33130 hcb4865c_18 conda-forge
werkzeug 3.0.1 pyhd8ed1ab_0 conda-forge
wheel 0.42.0 pyhd8ed1ab_0 conda-forge
whoosh 2.7.4 py311h1ea47a8_8 conda-forge
win_inet_pton 1.1.0 pyhd8ed1ab_6 conda-forge
wrapt 1.16.0 py311ha68e1ae_0 conda-forge
xlrd 2.0.1 pyhd8ed1ab_3 conda-forge
xlsxwriter 3.1.9 pyhd8ed1ab_0 conda-forge
xorg-libxau 1.0.11 hcd874cb_0 conda-forge
xorg-libxdmcp 1.1.3 hcd874cb_0 conda-forge
xz 5.2.6 h8d14728_0 conda-forge
zipfile-deflate64 0.2.0 py311ha68e1ae_4 conda-forge
zipp 3.17.0 pyhd8ed1ab_0 conda-forge
zstd 1.5.5 h12be248_0 conda-forge
(ab) C:\Windows\system32>
I simply removed the brightway and activity-browser environments using the terminal and reinstalled both. This time I tried to install activity-browser using "mamba" instead of conda. The installation worked fine. I opened my project and still could not open the activity tab. So I deleted the activities and started creating new ones. At first everything worked fine until I noticed that I could not add new technosphere flows. When this happened, I tried to calculate my unfinished model - nothing happens. I will also attach this code, maybe it is useful.
Dropevent from:<activity_browser.ui.tables.inventory.ActivitiesBiosphereTable(0x248d73296e0) at 0x00000248BD6256C0>
C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\ui\tables\models\lca_setup.py:158: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.
self._dataframe = pd.concat([self._dataframe,pd.DataFrame(data)], ignore_index=True)
Traceback (most recent call last):
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tab.py", line 62, in generate_setup
new_tab = LCAResultsSubTab(data, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 113, in __init__
self.mlca, self.contributions, self.mc = calculations.do_LCA_calculations(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\bwutils\calculations.py", line 28, in do_LCA_calculations
mlca = MLCA(cs_name)
^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\bwutils\multilca.py", line 146, in __init__
self.lca = self._construct_lca()
^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\bwutils\multilca.py", line 189, in _construct_lca
return bw.LCA(demand=self.func_units_dict, method=self.methods[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\bw2calc\lca.py", line 79, in __init__
clean_databases()
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\bw2calc\utils.py", line 102, in clean_databases
databases.clean()
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\bw2data\meta.py", line 121, in clean
return _clean()
^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\bw2data\project.py", line 358, in writable_project
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\bw2data\meta.py", line 114, in _clean
Database(x).process()
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\bw2data\backends\peewee\database.py", line 445, in process
if np.isnan(data['amount']) or np.isinf(data['amount']):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Thank you in advance :)
Hi @SELTENEERDEN,
You definitely ran into a weird bug. Is this something you experience in other brightway projects as well? Right now I'm thinking there may be something wrong in your database somewhere that's throwing the AB off.
Hi Marin, thanks for the advice. I have just created a new project. Next I created the biosphere flows and then remotely imported ecoinvent v.3.9.1. The first time I tried to import it, the activity browser just shut down. I cannot be sure at what stage of the import, but after downloading and decompressing the 7z. When I rebooted and tried to import again, I got an error telling me to update my biosphere streams. When I did this, the activity browser just shut down again. When I reopened it and updated the biosphere flows again, it worked. Next I re-imported ecoinvent and that worked too. I remember that all these steps or errors happened to me in the same order in the old project. I have just created a very simple LCA model. Just two processes with three ecoinvent activities and it worked fine. The LCIA results are also calculated with out flaws. But that was also the case with my last project. Let's see if everything stays fine or if the bugs appear again. I will keep you posted :)
Hi @SELTENEERDEN,
Thank you for your elaborate response. The issues you mention with the biosphere updater are known to us and will hopefully be fixed in the next patch, sorry for the trouble.
Would it be possible to export the database that's giving you trouble to excel and either upload it here, or send it to me at m.r.visscher@science.leidenuniv.nl? It may help us understand what's going on here.
Kind regards,
Marin
No sorry, I deleted it already. I did not think about how it could help you improve the software. If the bug reappears I will send you the database.
Ok, it did not take long for the bug to reappear. Now I have the same problem again. And the same error message. Is it perhaps a problem with the activity browser that an activity produces exactly the same amount as the downstream consumer needs? Like in my case, a mine produces 9 megatons of ore and the crusher requires 9 megatons of ore. So the scaling of the processes was already done. Anyway, I just saw, that I also can not export the database. The terminal shows the following:
Traceback (most recent call last):
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\ui\wizards\db_export_wizard.py", line 38, in accept
self.perform_export()
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\ui\wizards\db_export_wizard.py", line 52, in perform_export
EXPORTERS[export_as](db_name, out_path)
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\activity_browser\bwutils\exporters.py", line 132, in store_database_as_package
db.process()
File "C:\ProgramData\miniconda3\envs\ab\Lib\site-packages\bw2data\backends\peewee\database.py", line 445, in process
if np.isnan(data['amount']) or np.isinf(data['amount']):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Was already afraid that would happen, are you able to export as a .bw2package instead?
Hey, I don't really know what I changed, but it works now. I rebooted and started from scratch with a new project, only this time I made my new project the "default" and deleted the corrupted ones. Now my model is actually almost finished and I have not run into any bugs. I hope this did the trick :). Unfortunately I no longer have the corrupted ones as I deleted all the other projects, so I cannot try to export as bw2package.
Hah, weird. Well, I hope you don't run into any further bugs, and otherwise, let us know!
Closing for now, until the issue reappears in a reproducible manner
Updating AB
What happened?
When I try to open my activities to edit them, nothing happens. I can create new activities and sometimes also duplicating the old one help to be able to edit them for a short time. But when I close the activity and try to open again nothing happens again. The terminal gives me a type error.
Relevant errors
Operating system
Windows 10
Conda environment