<@ULVA73B9P> am trying to install dependecies in a...
# ask-marvin
r
@Marvin am trying to install dependecies in a seperate directory
Copy code
- 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 working
m
thought for 330.6 seconds
A few things to check that commonly cause this to “not work”: 1) Use the correct step path - The callable lives at
prefect.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):
Copy code
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:
Copy code
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:
Copy code
- 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)?