External Python libraries

Jul 2, 2025 | Knowledge Base

To add external libraries for using in the python rules, these are the steps:

Modify the docker-compose.override.yml:

x-shared-libs: &shared-libs:
environment:
PYTHONPATH: /opt/libs
volumes:
- python-libs:/opt/libs

services:
api:
<<: *shared-libs
celery:
<<: *shared-libs

volumes:
python-libs:

The above code makes sure a volume is added to hold the external libraries available to the (even future) containers, being mapped into /opt/libs.
Then, you can install whatever python package by:

docker exec -u 0 celery pip install pyrad

And upon successful installation, you can use it in your code:

@rule(...)
def rule_with_pyrad(...):
import pyrad
...

On this page
Explore our products
See what Flock9 can do for your network.
View products

Can't find what you need?

Our engineers answer questions on Discord and by ticket.