06/27/2023, 12:00 PM
@Marvin I’m getting this error while running a flow on my local machine:
Copy code
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/", line 310, in retrieve_flow_then_begin_flow_run
    flow = await load_flow_from_flow_run(flow_run, client=client)
  File "/usr/local/lib/python3.10/site-packages/prefect/client/", line 40, in with_injected_client
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/prefect/", line 197, in load_flow_from_flow_run
    await storage_block.get_directory(from_path=deployment.path, local_path=".")
  File "/usr/local/lib/python3.10/site-packages/prefect/", line 147, in get_directory
    copytree(from_path, local_path, dirs_exist_ok=True)
  File "/usr/local/lib/python3.10/", line 559, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
  File "/usr/local/lib/python3.10/", line 513, in _copytree
    raise Error(errors)
shutil.Error: [('/app/.venv/bin/python', '/tmp/tmpjt7optzvprefect/.venv/bin/python', "[Errno 2] No such file or directory: '/app/.venv/bin/python'"), ('/app/.venv/bin/python3', '/tmp/tmpjt7optzvprefect/.venv/bin/python3', "[Errno 2] No such file or directory: '/app/.venv/bin/python3'"), ('/app/.venv/bin/python3.10', '/tmp/tmpjt7optzvprefect/.venv/bin/python3.10', "[Errno 2] No such file or directory: '/app/.venv/bin/python3.10'")]


06/27/2023, 12:01 PM
It seems you're encountering a "Flow could not be retrieved from deployment" error. Based on the information I found, this issue might be related to the storage block and the path configuration. Here are some suggestions to help you resolve the issue: 1. Make sure the path to your flow is correct and accessible by the agent. In some cases, using an absolute path instead of a relative path might resolve the issue. 2. Verify that your execution layer has enough permissions to access the required resources, such as IAM roles and a valid Prefect API key. 3. Ensure that your execution layer has enough capacity on the cluster to deploy your flow run. If the agent is starved for resources, try allocating more CPU and memory to the agent process. 4. Check if there is more than one agent polling for runs from the same work queue. This can sometimes lead to pending runs that can't be deployed efficiently. For more information, you can refer to these discussions on Prefect Discourse: - My flow run in prefect 2 is stuck in a pending state what can i do - Remote agent not able to download from s3 storage If the issue persists, you might want to check the following GitHub issues for similar problems and potential solutions: - AttributeError when flow using kubernetes-client is ran via deployment - Agent fails to get flow from storage-block with path set as relative path - Intermittent fatal error running deployment with docker infra I hope this helps you resolve the issue. Good luck, and remember, humans are always one step away from another error.


06/27/2023, 12:15 PM
Solved by putting the storage block parameter in the deployment command
🙌 1