USEPA / ElectricityLCI

Creative Commons Zero v1.0 Universal
24 stars 10 forks source link

Update olca-ipc calls to use 0.12 #195

Open m-jamieson opened 1 year ago

m-jamieson commented 1 year ago

Fedelemflowlist and lciafmt are both requiring olca-ipc >= 0.12. Our current requirement is locked at 0.10. Updates need to be made to resolve conflicts, and I suppose stay with the times.

dt-woods commented 1 year ago

I received the following error after running the development branch of eLCI, which includes olca-ipc-0.0.12:

Traceback (most recent call last):
  File "main.py", line 147, in <module>
    main()
  File "main.py", line 31, in main
    upstream_dict = electricitylci.write_upstream_dicts_to_jsonld(upstream_dict)
  File "~/Repositories/usepa/ElectricityLCI/electricitylci/__init__.py", line 346, in write_upstream_dicts_to_jsonld
    upstream_dicts = write_process_dicts_to_jsonld(upstream_dicts)
  File "~/Repositories/usepa/ElectricityLCI/electricitylci/__init__.py", line 279, in write_process_dicts_to_jsonld
    from electricitylci.olca_jsonld_writer import write
  File "~/Repositories/usepa/ElectricityLCI/electricitylci/olca_jsonld_writer.py", line 405, in <module>
    def _process_ref(dict_d: dict) -> Optional[olca.ProcessRef]:
AttributeError: module 'olca' has no attribute 'ProcessRef'

This drums up a memory of version issues I ran in before. I'll try installing 0.0.10 and re-running.

dt-woods commented 1 year ago

Version 0.0.10 of olca-ipc does not solve the problem. Ran into this instead:

Traceback (most recent call last):
  File "main.py", line 147, in <module>
    main()
  File "main.py", line 31, in main
    upstream_dict = electricitylci.write_upstream_dicts_to_jsonld(upstream_dict)
  File "~/Repositories/usepa/ElectricityLCI/electricitylci/__init__.py", line 346, in write_upstream_dicts_to_jsonld
    upstream_dicts = write_process_dicts_to_jsonld(upstream_dicts)
  File "~/Repositories/usepa/ElectricityLCI/electricitylci/__init__.py", line 284, in write_process_dicts_to_jsonld
    olca_dicts = write(all_process_dicts, config.model_specs.namestr)
  File "~/Repositories/usepa/ElectricityLCI/electricitylci/olca_jsonld_writer.py", line 43, in write
    _process_dq(d_vals, process)
  File "~/Repositories/usepa/ElectricityLCI/electricitylci/olca_jsonld_writer.py", line 67, in _process_dq
    process.dq_system = olca.ref(olca.DQSystem, pdq_uid)
AttributeError: module 'olca' has no attribute 'DQSystem'
dt-woods commented 1 year ago

Digging between versions 0.0.10 and 0.0.12, it looks like olca-ipc has changed the language of ProcessRef to just Ref. That might be the fix that's needed!

bl-young commented 11 months ago

FYI olca-schema has been split out from olca-ipc. The olca-schema is primarily used for writing json and may be sufficient for eLCI purposes. We will be switching to requiring olca-schema >= v0.0.11 soon.

This all relates to use with openLCA 2.0

dt-woods commented 11 months ago

Current development is underway to update all the references to olca-schema classes and the new zipio reader/writer.