Hello - I'm trying to run the deployment and hitti...
# ask-community
p
Hello - I'm trying to run the deployment and hitting with the following error. Could someone please help me know whats happening here? Additional context I've created a deployment using python code While deploying the deployment code was not able to find the flow file Moved the flow file to Users\UserName\prefect Then the deployment code worked fine, I could see the deployment in the UI When I tried running the deployment, Im ending up with this error
Copy code
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prefect\engine.py", line 409, in retrieve_flow_then_begin_flow_run
    flow = await load_flow_from_flow_run(flow_run, client=client)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prefect\client\utilities.py", line 51, in with_injected_client
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prefect\deployments\deployments.py", line 235, in load_flow_from_flow_run
    await storage_block.get_directory(from_path=from_path, local_path=".")
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prefect\filesystems.py", line 156, in get_directory
    ignore_func = await self._get_ignore_func(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prefect\filesystems.py", line 167, in _get_ignore_func
    included_files = filter_files(root=local_path, ignore_patterns=ignore_patterns)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prefect\utilities\filesystem.py", line 45, in filter_files
    ignored_files = {p.path for p in spec.match_tree_entries(root)}
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prefect\utilities\filesystem.py", line 45, in <setcomp>
    ignored_files = {p.path for p in spec.match_tree_entries(root)}
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pathspec\pathspec.py", line 266, in match_tree_entries
    yield from self.match_entries(entries, negate=negate)
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pathspec\pathspec.py", line 159, in match_entries
    for entry in entries:
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pathspec\util.py", line 181, in iter_tree_entries
    yield from _iter_tree_entries_next(os.path.abspath(root), '', {}, on_error, follow_links)
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pathspec\util.py", line 251, in _iter_tree_entries_next
    yield from _iter_tree_entries_next(root_full, node_rel, memo, on_error, follow_links)
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pathspec\util.py", line 251, in _iter_tree_entries_next
    yield from _iter_tree_entries_next(root_full, node_rel, memo, on_error, follow_links)
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pathspec\util.py", line 251, in _iter_tree_entries_next
    yield from _iter_tree_entries_next(root_full, node_rel, memo, on_error, follow_links)
  File "C:\Users\ParashHallur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pathspec\util.py", line 220, in _iter_tree_entries_next
    raise RecursionError(real_path=dir_real, first_path=memo[dir_real], second_path=dir_rel)
pathspec.util.RecursionError: ('C:\\Users\\ParashHallur\\AppData\\Local', 'AppData\\Local', 'AppData\\Local\\Application Data')
Any help here is appreciated.
👀 1
b
Hi Parash, thanks for your message. Can you share the code you're using to create your deployment?
p
Hello @Bianca Hoch - Thank you for your response. Here is the code I've used to create a deployment
from DeploymentDemo import workflow
from prefect.deployments import Deployment
deployment = Deployment.build_from_flow(
flow=workflow,
name="Deployment Example - 1",
)
if __name__ == "__main__":
deployment.apply()
And my flow code
Copy code
from prefect import flow, task

# First Task
@task
def firstTask():
    print("First Task Executed")

# First Task
@task
def secondTask():
    print("Second Task Executed")


# First Task
@task
def thirdTask():
    print("Third Task Executed")



# Define the Prefect flow
@flow
def workflow():
    print("\n Starting the workflow")
    firstTask()
    secondTask()
    thirdTask()
    print("\n Workflow Execution completed")

# Run the Prefect flow
if __name__ == "__main__":
    workflow()