Hristo Mavrodiev
09/27/2025, 3:15 PMMarvin
09/27/2025, 3:15 PMMarvin
09/27/2025, 3:20 PMEXTRA_PIP_PACKAGES straight into a pip install ... call, so packages are split on spaces (shell whitespace). Do not use commas.
Examples
- Docker (docker run)
docker run --rm \
-e PREFECT_API_URL="..." \
-e PREFECT_API_KEY="..." \
-e EXTRA_PIP_PACKAGES="pandas==2.2.2 requests>=2.31 'pyarrow<17' git+https://github.com/org/pkg@v1.2.3" \
prefecthq/prefect:3-latest
- Prefect 3.x Docker or Kubernetes work pool (job_variables in prefect.yaml)
deployments:
- name: my-flow
work_pool:
name: my-k8s-or-docker-pool
job_variables:
image: prefecthq/prefect:3-latest
env:
EXTRA_PIP_PACKAGES: "pandas==2.2.2 requests>=2.31"
- Kubernetes manifest (worker Deployment)
apiVersion: apps/v1
kind: Deployment
metadata:
name: prefect-worker
spec:
template:
spec:
containers:
- name: worker
image: prefecthq/prefect:3-latest
env:
- name: EXTRA_PIP_PACKAGES
value: "pandas==2.2.2 requests>=2.31"
- Helm values (generic pattern)
worker:
env:
- name: EXTRA_PIP_PACKAGES
value: "pandas==2.2.2 requests>=2.31"
- Cloud Run (gcloud)
gcloud run deploy prefect-worker \
--image=prefecthq/prefect:3-latest \
--region=us-central1 \
--set-env-vars=EXTRA_PIP_PACKAGES="pandas==2.2.2 requests>=2.31"
Notes
- Quote values that include special shell characters (e.g., <, >) to avoid shell parsing issues.
- Newlines also count as whitespace, but a single space-delimited string is simplest.
- Because this installs at container startup, prefer baking dependencies into your image or using a pull step/requirements file for reproducibility when possible.
Related docs
- Prefect 3.x: Docker deployments
- Prefect 3.x: Kubernetes deployments