Slackbot
11/29/2025, 7:02 PMMarvin
11/29/2025, 7:02 PMMarvin
11/29/2025, 7:07 PMpull:
- prefect.deployments.steps.git_clone:
id: repo
repository: <https://github.com/your-org/your-repo.git>
# branch: main # optional
- prefect.deployments.steps.pip_install_requirements:
directory: "{{ repo.directory }}"
requirements_file: requirements.txt # update if your file lives elsewhere
deployments:
- name: my-deployment
entrypoint: flows/flow.py:your_flow
work_pool:
name: your-docker-pool
Notes:
- Step name is exactly: prefect.deployments.steps.pip_install_requirements
- It expects a requirements.txt. If you only have a pyproject.toml, consider Option B or C.
Option B: Install at container startup via environment variable
If you’re using a Prefect base image (e.g., prefecthq/prefect:3-latest), you can have the container install packages on startup using EXTRA_PIP_PACKAGES.
- Per-deployment (recommended for targeted changes):
deployments:
- name: my-deployment
entrypoint: flows/flow.py:your_flow
work_pool:
name: your-docker-pool
job_variables:
env:
EXTRA_PIP_PACKAGES: "pandas==2.2.2 numpy"
- Or set this at the work pool level (applies to all jobs in that pool) via the UI by editing the pool’s base job template env and adding EXTRA_PIP_PACKAGES.
Option C (best for production): Bake deps into your Docker image
Build and use a Docker image that already contains your code and dependencies. You can do this in prefect.yaml with the docker build step and point your deployment at that image:
build:
- prefect_docker.deployments.steps.build_docker_image:
requires: prefect-docker>=0.3.0
image_name: your-registry/your-image
tag: latest
dockerfile: auto # Prefect will generate a Dockerfile
# By default this installs from requirements.txt in your project root
deployments:
- name: my-deployment
entrypoint: flows/flow.py:your_flow
work_pool:
name: your-docker-pool
job_variables:
image: "{{ build-image.image }}"
This yields the fastest, most reproducible runs.
What I recommend right now
- If you just need to unblock quickly: add Option A’s pip_install_requirements pull step (since you’re already using git_clone), or Option B’s EXTRA_PIP_PACKAGES with pandas.
- Longer term: switch to Option C to bake your requirements into the image.
A couple of quick questions to tailor the fix:
- Do you have a requirements.txt in the repo (and where is it located)?
- Are you deploying with a prefect.yaml (looks like it), or via Python’s flow.deploy?
- Do you want a quick fix (runtime install) or a more robust image build setup?
Share your current prefect.yaml (redact secrets) and I can suggest the exact minimal changes.