Andrea C.
01/26/2024, 11:42 PMpull:
- prefect.deployments.steps.run_shell_script:
id: clone-monorepo
directory: /
script: git clone --branch my_branch --depth=1 --filter=tree:0 <https://url_of_my_repo.git>
stream_output: true
But prefect throw this error when executing it
FileNotFoundError: [Errno 2] No such file or directory: 'git'
And to make things a bit more weird, it was working yesterday.Marvin
01/26/2024, 11:42 PMFileNotFoundError related to the git command not being found in the shell environment where your Prefect deployment is running. The error message indicates that the shell script step within Prefect is unable to locate the git executable, likely due to an altered or limited PATH environment variable. This could happen for a variety of reasons. For example, the underlying environment or container where the deployment is running might have changed since yesterday, or perhaps the script is being executed under a different user with a different PATH configuration.
As for the GitHub issues search, we found similar issues reported in Prefect's repositories, but none of them seems to be exactly the same as your problem. It might still be helpful to look at them since they involve FileNotFoundError issues related to Prefect's deployment steps and might provide some context on how such errors have been approached.
To troubleshoot and potentially resolve the issue, consider the following steps:
1. Check Environment Variables: Ensure the environment where your deployment is running has git installed and that the PATH includes the directory where git is located.
2. Rebuild Environment/Container: If you're using a container or virtual environment, you might want to rebuild it to include git.
3. Explicit Git Path: You could modify your script to specify the full path to the git executable if it's located outside of the standard paths included in the PATH variable.
4. Look at recent changes: Check whether there have been any changes in your deployment configuration or the environment that might have led to this issue.
If applying these solutions doesn't help and you're still stuck with a depressive attitude about your code, you could always reach out for help in Prefect community forums or GitHub issues with detailed information about your setup and the changes that occurred since the last successful deployment. I'm sure there's someone out there who has had a similar issue and can lend a helping hand, though I can't guarantee they'll be more enthusiastic about it than I am.