This article covers how the IPC connection works, what the client can do, and what data types are available.
The IPC server
The IPC server is already part of openLCA.
- Open your database in openLCA
- Go to Tools > Developer Tools > IPC Server
- Leave the port as 8080
- Click the green play button
- The status shows Running when it’s ready
openLCA needs to stay open while your scripts run. Closing openLCA drops the connection. If something else is using port 8080, you can change it before clicking play, then update the port number in your scripts to match.
The Python packages
One package is needed:
- olca-ipc is the client library that sends requests to the IPC server. It includes olca-schema, which defines the data types (processes, flows, product systems, calculation setups) as Python objects.
pip install olca-ipc
A more detailed connection example
This script connects to openLCA, counts the processes and flows in your database, and prints the first three of each.
from olca_ipc import Client
import olca_schema as o
client = Client(8080)
processes = client.get_descriptors(o.Process)
flows = client.get_descriptors(o.Flow)
print(f"Found {len(processes)} processes")
print(f"Found {len(flows)} flows")
print("\nFirst 3 processes:")
for process in processes[:3]:
print(f" {process.name}")
print("\nFirst 3 flows:")
for flow in flows[:3]:
print(f" {flow.name}")
How the client works
Client(8080) creates a connection to the IPC server. From that point, client can send requests to openLCA: fetching data, running calculations, creating product systems, reading parameters.
get_descriptors returns a Python list containing lightweight references (name, ID, category) for every entity of a given type. Lists are a standard Python data structure, and you can work with them in the usual ways: len(processes) gives you the count, processes[0] gives you the first item, and processes[:3] gives you the first three. The for process in processes[:3] loop in the example above iterates over that slice and prints each name.
These are lightweight references, so the call is fast even on large databases. When you need the full object with all its exchanges, parameters, and documentation, you call client.get(o.Process, process_id) on a specific entity.
The olca_schema module (imported as o) provides the Python classes that map to openLCA’s data model: o.Process, o.Flow, o.ProductSystem, o.CalculationSetup, and so on.
What you can access
The IPC server exposes most of what you can see in the openLCA GUI:
- Processes and their exchanges, parameters, documentation
- Flows (product, waste, elementary)
- Product systems and their parameter sets
- Impact assessment methods and categories
- Calculation results (total impacts, contributions, inventories)
- Global parameters
You can also create and modify entities: building product systems from processes, updating parameter values, adding documentation.
Troubleshooting
Connection refused usually means the IPC server isn’t running. Worth checking openLCA is open, the server is started, and the port matches.
Empty results means the connection is working but the database has no processes. This usually means a different database is open in openLCA.
Import errors mean the packages may not be installed, or you might be running a different Python installation from the one you installed them into. pip show olca-ipc will confirm.
