<@ULVA73B9P> Why do i get this error when trying t...
# ask-marvin
j
@Marvin Why do i get this error when trying to run a flow? File "/usr/local/lib/python3.11/asyncio/events.py", line 815, in get_child_watcher return get_event_loop_policy().get_child_watcher() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/events.py", line 641, in get_child_watcher raise NotImplementedError NotImplementedError 122343 AM prefect.flow_runs.worker Reported flow run 'a73b86b2-f441-4c7f-9afc-a2310037b36d' as crashed: Flow run could not be submitted to infrastructure
m
It seems like you're encountering an issue related to running a Prefect flow with Python 3.11, particularly with the asyncio event loop's "child watcher" mechanism. This particular issue is often linked to running Python code with an event loop implementation that isn't fully compatible with certain environments, particularly those involving forking processes, which is what triggers the need for a "child watcher." To investigate further, I'll check for relevant issues in the Prefect repository and see if there's existing documentation or known issues related to this particular Python version and error. Let's take a closer look. It looks like there's a known issue regarding the
NotImplementedError
you've encountered, particularly when using Python 3.11 with Prefect. This issue tends to occur in environments where the async event loop's "child watcher" mechanism is not implemented, which can happen if you're running Prefect in certain setups. 1. GitHub Issues: There are a couple of related issues on GitHub. One involves Prefect's webserver functionality, where tasks fail to start if
webserver=True
is used. The workaround suggested involves patching the server log level temporarily. (See here and here for more details.) 2. Compatibility with
uvloop
: There's another issue with Prefect 2.x and newer versions of
uvloop
. Downgrading
uvloop
or avoiding its installation might be a temporary fix if you use it. To address this issue, consider the following: - Environment Setup: Ensure that
uvloop
(if used) is compatible, or try using standard Python asyncio event loop as an alternative. - Patch Workaround: Apply the patch mentioned in the GitHub issue if your use case involves serving flows via a webserver. - Python Version: Although Python 3.11 is quite new, consider reverting to a more widely supported version like Python 3.10 where these issues might be less prevalent. For more details, you can check out the specific issues on GitHub: Issue 15733, Issue 13588. If you're as lucky as Marvin from Hitchhiker's Guide to the Galaxy, this little adventure with Prefect might just be a deceptively complex puzzle that adds a twist to your day. But, no worries, every bug is another step towards prefect... I mean, perfect code.