0 votes
388 views

Hi 

I got this message: ERROR:root:calculation failed: -32601: Does not understand: calculate when I run this (after connecting to IPC server to OpenLCA 2.0.3): 

setup = olca.CalculationSetup()

setup.calculation_type = olca.CalculationType.UPSTREAM_ANALYSIS

setup.product_system = olca.ref(

    olca.ProductSystem,

    '5db4432c-2407-4ceb-bf26-886975ef8ed0'

)

setup.impact_method = olca.ref(

    olca.ImpactMethod,

    '8280f30d-2cdd-3451-b0d2-2e439f836b1e'

)

setup.amount = 1.0

result = client.calculate(setup) 

I tried to install Olca through: 

pip install -U olca-ipc

but I got this message when I run the same code:

ModuleNotFoundError: No module named 'olca'

So I am using Olca 0.0.12:

pip install olca-ipc==0.0.12

Any ideas what is the problem ?

Thanks in advance !

in openLCA by (130 points)

1 Answer

+1 vote
by (5.0k points)
Hi,

Are you using the IPC server with openLCA? If yes, what version of openLCA are you using?

I would advise to use the latest version of openLCA with the latest version of olca-ipc. Did you check the documentation (https://greendelta.github.io/openLCA-ApiDoc/ipc/)?

Cheers,

François
by (130 points)
Hi François,

Thanks for your answer !
Yes, I am using IPC server and the latest version of openLCA 2.1.0 and following the documentation, but still not working.
by (5.0k points)
If you are using openLCA 2.1.0 then it is best to use the latest version of `olca-ipc` and `olca-schema`.
Then, if you are using the latest version of `olca-ipc`, there is no `calculation_type` field for a `CalculationSetup` object (see https://greendelta.github.io/olca-schema/classes/CalculationSetup.html?highlight=calcula#python-class-stub).

For example, does the following work?

```python
import olca_ipc as ipc
import olca_schema as o

# create a calculation setup
setup = o.CalculationSetup(
    target=o.Ref(
        ref_type=o.RefType.ProductSystem,
        id="5db4432c-2407-4ceb-bf26-886975ef8ed0'",
    ),
    impact_method=o.Ref(id="8280f30d-2cdd-3451-b0d2-2e439f836b1e'"),
)

# run a calculation
client = ipc.Client()
result: ipc.Result = client.calculate(setup)
```
by (130 points)
Yess it works. Cause 'calculation_type' is included here in the documentation:
https://greendelta.github.io/olca-ipc.py/olca/schema.html#olca.schema.CalculationSetup
Thanks for your answer :)
by (5.0k points)
This is the documentation for 0.0.12 only. I am sorry that it was not clear.
...