Raj Kumar Nishad
11/04/2025, 10:37 AM- prefect.deployments.steps.run_shell_script:
script: /home/ubuntu/prefect-venv/bin/pip install -r {{ clone_step.directory }}/requirements.txt
stream_output: true
its not workingMarvin
11/04/2025, 10:37 AMMarvin
11/04/2025, 10:43 AMprefect.deployments.steps.utility.run_shell_script, not prefect.deployments.steps.run_shell_script.
2) Make sure you’re referencing the right step output
- {{ clone_step.directory }} only works if your clone step has id: clone_step and returns a directory field (e.g., git_clone does).
3) Quote templated strings in YAML
- Wrap the script value in quotes when you include {{ ... }} to avoid YAML parsing issues.
4) Run the step in the right phase
- If you need to install on the machine that will run your flow (e.g., your worker host with /home/ubuntu/prefect-venv), put this in the pull: section. Steps under build: run where you call prefect deploy (often your local machine or CI), not on the worker.
Recommended approach (built-in step for requirements):
pull:
- prefect.deployments.steps.pull.git_clone:
id: clone_step
repository: <https://github.com/owner/repo.git>
branch: main
- prefect.deployments.steps.utility.pip_install_requirements:
directory: "{{ clone_step.directory }}"
requirements_file: requirements.txt
stream_output: true
If you really want to call a specific pip path:
pull:
- prefect.deployments.steps.pull.git_clone:
id: clone_step
repository: <https://github.com/owner/repo.git>
branch: main
- prefect.deployments.steps.utility.run_shell_script:
directory: "{{ clone_step.directory }}"
script: "/home/ubuntu/prefect-venv/bin/pip install -r requirements.txt"
stream_output: true
Or, keeping your original style but fixing the path and quoting:
- prefect.deployments.steps.pull.git_clone:
id: clone_step
repository: <https://github.com/owner/repo.git>
- prefect.deployments.steps.utility.run_shell_script:
script: "/home/ubuntu/prefect-venv/bin/pip install -r {{ clone_step.directory }}/requirements.txt"
stream_output: true
Docs for reference:
- Steps utility (run_shell_script, pip_install_requirements)
- prefect.yaml guide
If it’s still failing, could you share:
- Which section you placed the step in (build, push, or pull)?
- The exact error output from the failed step?
- How your clone step is defined (to confirm its id and output)?