FileNotFoundError: [Errno 2] No such file or directory creating a flow run from a deployment

My deployment is as follows:

from prefect.deployments import Deployment
from prefect.filesystems import GitHub
from fl_blob_ingestion import main_flow

storage = GitHub.load("athenix-prefect")

deployment = Deployment.build_from_flow(
    flow = main_flow, # name of the flow function
    name = "dp_blob_ingestion_zonda", # name of deployment
    work_queue_name = "blob_ingestion_zonda",
    storage = storage

if __name__ == "__main__":

I get this error everytime I run it

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\galtman\\AppData\\Local\\Temp\\tmp0t1_en1hprefect\\'

not sure what the problem is, it worked before when I made a deployment the same way about a month ago.

can you try deployment from CLI? here is a list of resources you can check:

I’ve tried deploying every way possible, I still get the same error. I’ve done both on Orion and the Cloud, as well as using the CLI and using the python object for each.

It worked a month ago so not sure what may have changed.

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\galtman\\Documents\\pref_temp\\'


how can I get it to look at this path instead?

my path is showing in the error message now since I’ve added it here in the process infrastructure block for the deployment

So now it builds the whole thing in that path but I have my main flow file in


So I need that earlier method to point to that path instead. Any idea how it can be done? @anna_geller

you could leverage --path argument on the prefect deployment build CLI, or use Process block instead at first, rather than the GitHub block

Can you give me an example of what the path argument does? I’ve also tried putting it in the path argument in the CLI but I get the same result. I’ve tried all these in the yaml

path: 'blob_ingestion'
path: 'blob_ingestion\'
path: '\blob_ingestion\'

I meant setting this on the CLI argument, not in YAML

you could read more in the CLI docs or by adding --help in the CLI on any command

Isn’t it the same thing though? Setting it through CLI or adding it in the yaml deployment file? Either way, I did that but still get the same result.

Here is my cli execution:

prefect deployment build -n 'dp_blob_ingestion_zonda' -q 'default'  -sb github/github-test --path 'blob_ingestion' --apply

I have found the solution thanks to @EmilRex

I had to run the deployment from the root of the directory instead of at a deeper level.

For CLI:
Didn’t work

(venv) PS C:\Users\galtman\Documents\proj_folder\ingestion> prefect deployment build 
-n 'ingestion_zonda' 
-q 'ingestion_zonda' 
-sb github/my_repo
--path ingestion


(venv) PS C:\Users\galtman\Documents\proj_folder> prefect deployment build ingestion/ 
-n 'ingestion_zonda' 
-q 'ingestion_zonda' 
-sb github/my_repo

1 Like
from src.flows import test_flow

    my_deployment = Deployment.build_from_flow(

I am getting following error, my src\ and folder are in same directory.
when I debug I see following value under my deployment
my_deployment.entrypoint = src/flow/
my_deployment.path = path/of/project_dir

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\MKU271\\AppData\\Local\\Temp\\tmp8dz374otprefect\\containers\\prefect-agent\\src\\flows\\'
prefect.exceptions.ScriptError: Script at 'containers\\prefect-agent\\src\\flows\\'