Using CLI gave me the same error. After trying on a different computer, I seems that prefect agent doesnโt recognize spaces in my python path. Creating a new venv partly help me solve the issue
Starting v2.7.5 agent with ephemeral API...
___ ___ ___ ___ ___ ___ _____ _ ___ ___ _ _ _____
| _ \ _ \ __| __| __/ __|_ _| /_\ / __| __| \| |_ _|
| _/ / _|| _|| _| (__ | | / _ \ (_ | _|| .` | | |
|_| |_|_\___|_| |___\___| |_| /_/ \_\___|___|_|\_| |_|
Agent started! Looking for work from queue(s): test...
15:01:05.831 | INFO | prefect.agent - Submitting flow run '37009a73-2d6e-4f39-8f21-fd9fd9ab1bef'
15:01:05.996 | INFO | prefect.infrastructure.process - Opening process 'ginger-iguana'...
15:01:06.032 | INFO | prefect.agent - Completed submission of flow run '37009a73-2d6e-4f39-8f21-fd9fd9ab1bef'
C:\Users\john\AppData\Local\Programs\Python\Python39\lib\runpy.py:127: RuntimeWarning: 'prefect.engine' found in sys.modules after import of package 'prefect', but prior to execution of 'prefect.engine'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
15:01:09.241 | DEBUG | prefect.client - Using ephemeral application with database at sqlite+aiosqlite:///C:\Users\john\.prefect\orion.db
15:01:09.349 | DEBUG | Flow run 'ginger-iguana' - Loading flow for deployment 'newDeployment'...
15:01:09.353 | ERROR | Flow run 'ginger-iguana' - Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\prefect\engine.py", line 262, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\prefect\client\utilities.py", line 47, in with_injected_client
return await fn(*args, **kwargs)
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\prefect\deployments.py", line 181, in load_flow_from_flow_run
flow = await run_sync_in_worker_thread(load_flow_from_entrypoint, str(import_path))
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\prefect\utilities\asyncutils.py", line 91, in run_sync_in_worker_thread
return await anyio.to_thread.run_sync(
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\prefect\flows.py", line 772, in load_flow_from_entrypoint
flow = import_object(entrypoint)
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\prefect\utilities\importtools.py", line 206, in import_object
module = load_module(module_name)
File "C:\Users\john\Documents\PythonVenv\Prefectv2\lib\site-packages\prefect\utilities\importtools.py", line 177, in load_module
return importlib.import_module(module_name)
File "C:\Users\john\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named '<input>'
15:01:09.402 | DEBUG | prefect.client - Using ephemeral application with database at sqlite+aiosqlite:///C:\Users\john\.prefect\orion.db
15:01:09.816 | INFO | prefect.infrastructure.process - Process 'ginger-iguana' exited cleanly.
So now the flow start running but I donโt know how to solve this ModuleNotFoundError