pjamesjoyce / futura

Software interface to generate arbitrary future background databases for LCA sensitivity analyses (building on wurst and rmnd-lca)
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

Problem writing the modified ecoinvent database #6

Open leabrd opened 1 year ago

leabrd commented 1 year ago

Hi,

I encountered an issue when trying to write the modified version of ecoinvent to brightway i.e. step 5 of the example notebook "Write our new database to Brightway2".

I get this error when running f.write_database():

###############################
Vacuuming database 
18202 datasets
617877 exchanges
0 unlinked exchanges

Writing activities to SQLite3 database:
0% [##############################] 100% | ETA: 00:00:00
Total time elapsed: 00:00:22
Title: Writing activities to SQLite3 database:
  Started: 03/17/2023 08:18:21
  Finished: 03/17/2023 08:18:43
  Total time elapsed: 00:00:22
  CPU %: 104.00
  Memory %: 20.38
Traceback (most recent call last):
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/futura_ui/app/threads.py", line 44, in run
    for n, i in enumerate(self.function()):
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/futura_ui/app/controller.py", line 512, in run
    loader.database.write_database(project, database, True)
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/futura/wrappers.py", line 308, in write_database
    w.write_brightway2_database(self.db, name)
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/wurst/brightway/write_database.py", line 53, in write_brightway2_database
    WurstImporter(name, data).write_database()
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/wurst/brightway/write_database.py", line 21, in write_database
    super().write_database()
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/bw2io/importers/base_lci.py", line 269, in write_database
    db.write(existing)
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/bw2data/project.py", line 358, in writable_project
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/bw2data/backends/peewee/database.py", line 266, in write
    self.make_searchable(reset=True)
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/bw2data/project.py", line 358, in writable_project
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/bw2data/backends/peewee/database.py", line 311, in make_searchable
    IndexManager(self.filename).add_datasets(self)
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/bw2data/search/indices.py", line 47, in add_datasets
    writer.add_document(**self._format_dataset(ds))
                          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leabraud/miniconda3/envs/futura/lib/python3.11/site-packages/bw2data/search/indices.py", line 35, in _format_dataset
    categories=u", ".join(ds.get(u"categories", [])).lower(),
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: can only join an iterable

Any advice on how to solve the issue? I am using the ecoinvent v.3.6 cut-off.

Thanks