0 votes
20 views

Hello,

I am trying to automatically extract the contribution tree results into excel files. For this reason, I installed the olca-ipc package using pip install -U olca-ipc in my virtual environment running Python 3.12.2. I get a ModuleNotFoundError: No module named 'olca' when trying to import the olca module from olca-ipc via import olca into my jupyter notebook.
I've tried uninstalling and reinstalling olca-ipc. I have tried clearing the cache before reinstalling. I have also created a kernel from my environment using:
python -m ipykernel install --user --name=myenv --display-name="Python (myenv)"

and connected this kernel to my notebook. I still can't import the module and would be grateful for any ideas.

edit:

import olca_ipc
import olca_schema as o
from olca_schema import CalculationType

client = olca_ipc.Client(8080)

product_system = client.get(o.ProductSystem, product_system_id)
impact_method = client.get(o.ImpactMethod, impact_method_id)

setup = o.CalculationSetup(
    target=o.Ref(o.RefType.ProductSystem, product_system_id),
    impact_method=o.Ref(o.RefType.ImpactMethod, impact_method_id),
    calculation_type=o.CalculationType.CONTRIBUTION_ANALYSIS
)

ago in openLCA by (300 points)
edited ago by

1 Answer

0 votes
ago by (7.4k points)

Hello,

Could you try to import olca_ipc instead of olca?

Regards,

François

ago by (300 points)
This was indeed (part of) the problem, thank you! I was under the impression that the olca module was part of the olca-ipc package. However, now when trying to make use of the ContributionAnalysis class variable inside CalculationType as in the code I added to my question, I get an AttributionError: module 'olca_schema' has no attribute 'CalculationType'.
I checked the schema.py file and did not find the class CalculationType. Seems like I missed something when installing olca-ipc using pip?
...