brightway-lca / brightway2-io

Importing and exporting for the Brightway LCA framework
BSD 3-Clause "New" or "Revised" License
26 stars 40 forks source link

Database setup fails with KeyError: 'name' #224

Open SamiraHuber opened 11 months ago

SamiraHuber commented 11 months ago

I'm currently facing an issue with the brightway2 package, when running the command agb_importer.write_database() to set up the database. The error I encounter is:

Traceback (most recent call last):
  File "/home/tu/git-repo/LCAI-API/setup/main.py", line 253, in <module>
    main()
  File "/home/tu/git-repo/LCAI-API/setup/main.py", line 160, in main
    agb_importer.write_database()
  File "/home/tu/.local/lib/python3.10/site-packages/bw2io/importers/simapro_csv.py", line 103, in write_database
    db = super(SimaProCSVImporter, self).write_database(data, name, *args, **kwargs)
  File "/home/tu/.local/lib/python3.10/site-packages/bw2io/importers/base_lci.py", line 242, in write_database
    duplicates.append(o["name"])
KeyError: 'name'

This setup involves using the CSV version of Agribalyse for data. The command works fine on my and my coworkers local machines (One windows user, on mac user) and has worked in Docker in the past. We haven't changed anything since than. However, now it throws an error in the Docker environment and on other servers. We've ensured that the Python version and package versions are identical across setups (see requirements.txt).

requirements.txt

What could be causing this discrepancy between environments, and how might I resolve it? We would really appreciate any kind of tipp or idea on how to make it run again.

amadotalita commented 7 months ago

Hi, I am having the same problem. Any solution so far?

SamiraHuber commented 7 months ago

Hi, I am having the same problem. Any solution so far?

@amadotalita So far I could only solve it by using following versions:

brightway2==2.4.2
bw2io==0.8.7

But I hope they fix it for the new versions soon!

amadotalita commented 7 months ago

Yes, let's wait then. thank you