cyrillefrancois / openlca2bw

Other
9 stars 5 forks source link

AttributeError: module 'olca_schema' has no attribute 'Category' #9

Closed qtu-UBC closed 7 months ago

qtu-UBC commented 7 months ago

Hello, I ran into the following error when trying execute "load_openLCA_IPC()"

File "C:\Users\XXX\Documents\openlca2bw_2x_gen.venv\Lib\site-packages\openlca2bw\main.py", line 102, in load_openLCA_IPC process_folders = [return_attribute(c,'name') for c in client.get_all(olca.Category) ^^^^^^^^^^^^^ AttributeError: module 'olca_schema' has no attribute 'Category'

I'm using openlca2bw==0.0.0, thank you!

nicolito commented 7 months ago

I got the same error, running on same openlca2bw version using python 3.11. olca_schema installed is version 0.0.12.

I spent some time digging into this. It seems 'Category' was a class in olca_schema version 0.0.1, but removed after that.

I did try downgrading, but it is not possible since openlca2bw won't import due to other dependency problems that follow (olca_schema requires an older version of olca-ipc, but openlca2bw requires version 0.0.12 of olca-ipc)

I think the code in main.py referred to above needs to be updated to work with the latest olca_schema version. I do not have enough insigh into these modules to be able to help with it, but would very much appreciate if someone would do it.

This project is super useful

cyrillefrancois commented 7 months ago

Thanks for this return. I find that I use an old version of olca_schema that had olca.Category entity. I have make an update of the pip version (now named openlca2bw==1.0.0) Appreciate your comments, but I find more and more complex to follow both OpenLCA and brightway updates.

nicolito commented 7 months ago

Thanks. That took care of this issue. Waiting for the import process to finish to see if there are any other easter eggs waiting :P I can certainly understand the difficulties you are facing. Just want to let you know that this tool you have developed is a life saver for those f us who want to work with python/brightway, but forced to collaborate with those who do not know python, using openlca.

This issue can now be marked as closed, in my opinion

qtu-UBC commented 7 months ago

I want to echo @nicolito's comment. Thank you very much for developing this library, which will greatly enhance the collaboration between LCA practitioners for data sharing. BTW, import process was successful on my machine after I updated the library!