Is wurst incompatible with ecoinvent 3.4?
Closed this issue · 8 comments
When trying one of the example notebooks, I ran into issues when using ecoinvent 3.4. Is wurst compatible with ecoinvent 3.4?
data = w.extract_brightway2_databases(["ecoinvent 3.4 cutoff"])
AttributeError: 'list' object has no attribute 'items'
Yes, it should work with any databases created/imported into bw2.
When you run bw.databases
do you see your "ecoinvent 3.4 cutoff" database?
Are you in a brightway2 project where you loaded the ecoinvent3.4 cutoff db? bw.projects.set_current('bw2project')
?
Thanks for having a look! Yes and yes. I am using a functional project and database.
The full error output:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-fd93c5cf3ebf> in <module>()
----> 1 data = w.extract_brightway2_databases(["ecoinvent 3.4 cutoff"])
/usr/local/miniconda3/envs/bw2/lib/python3.6/site-packages/wurst/brightway/extract_database.py in extract_brightway2_databases(database_names)
121 # Retrieve all activity data
122 print("Getting activity data")
--> 123 activities = [extract_activity(o) for o in tqdm(activity_qs)]
124 # Add each exchange to the activity list of exchanges
125 print("Adding exchange data to activities")
/usr/local/miniconda3/envs/bw2/lib/python3.6/site-packages/wurst/brightway/extract_database.py in <listcomp>(.0)
121 # Retrieve all activity data
122 print("Getting activity data")
--> 123 activities = [extract_activity(o) for o in tqdm(activity_qs)]
124 # Add each exchange to the activity list of exchanges
125 print("Adding exchange data to activities")
/usr/local/miniconda3/envs/bw2/lib/python3.6/site-packages/wurst/brightway/extract_database.py in extract_activity(proxy)
19 'exchanges': [],
20 'parameters': {key: value['amount'] for
---> 21 key, value in proxy.data.get('parameters', {}).items()}
22 }
23
AttributeError: 'list' object has no attribute 'items'
No problem and unfortunately I now get the exact same error message in a project where I re-imported ecoinvent 3.4 in BW2 today.
However, I do not get any error when extracting in a project where I imported ei34 in BW2 two months ago.
That is odd. May this be actually a compatibility issue between brightway and wurst? Do you intend to investigate further?
Yes, maybe there was a slight change in the way ecoinvent is imported in bw2 which makes it incompatible with the w.extract_brightway2_databases()
function. I will definitely further investigate and keep you posted.
This seems to be an issue of the updated brightway importer. Everything worked fine with Brightway 2.1.1 and bw2io 0.6 RC2 and ecoinvent 3.4. Now that I just updated to Brightway 2.3 and bw2io 0.6 I get the same error that you guys are getting.
I guess this is something with the way that Wurst is trying to import the parameters, because some datasets have none, and this is causing the problem. I guess a temporary workaround will be to use the older version of brightway.
Thanks for looking into this. I went back running this in the command --> conda install bw2io==0.6.RC3
It is working again now.
conda install bw2io==0.6.RC3
Thanks for the workaround! In case I end up looking deeper into the code I will make a pull request in the next days.