Skip to content

Instantly share code, notes, and snippets.

@devanubis
Last active March 1, 2022 17:24
Show Gist options
  • Save devanubis/ec452950c317d3684016dd3b609ebca3 to your computer and use it in GitHub Desktop.
Save devanubis/ec452950c317d3684016dd3b609ebca3 to your computer and use it in GitHub Desktop.
Helics matplotlib conflict
version: "3"
networks:
helics:
services:
federate:
build: .
depends_on:
- "helics"
hostname: federate
networks:
- helics
volumes:
- .:/app
command:
python reproduce.py
helics:
image: helics/helics:latest
hostname: helics
networks:
- helics
command:
helics_broker --federates=1 --name=test --ipv4 --localport=23456
FROM python:3.10-slim
WORKDIR /app
RUN pip install -U pip helics matplotlib
CMD ["python reproduce.py"]
# Importing matplotlib BEFORE helics results in exception
import matplotlib
import helics
import json
import socket
fed = helics.helicsCreateCombinationFederateFromConfig(json.dumps({
"name": "test_federate",
"core_type": "zmq",
"federates": 1,
"broker_port": 23456,
"broker_address": socket.gethostbyname('helics'),
}))
print("Connected to broker")
print(fed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment