langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
33.55k stars 4.07k forks source link

Unclosed event loop error when running langflow #4436

Open SavvySupport opened 20 hours ago

SavvySupport commented 20 hours ago

Bug Description

When I run langflow (version .19.post2), it gives me this error message.

Reproduction

  1. langflow run
  2. langflow runs as per usual however there is this error message: /usr/lib/python3.10/asyncio/base_events.py:688: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False> _warn(f"unclosed event loop {self!r}", ResourceWarning, source=self) ResourceWarning: Enable tracemalloc to get the object allocation traceback

Expected behavior

Should not show the error message.

Who can help?

No response

Operating System

Mac

Langflow Version

1.0.19.post2

Python Version

3.10

Screenshot

https://prnt.sc/oxA7HXe2xMk0

Flow File

No response

dosubot[bot] commented 20 hours ago

To resolve the "unclosed event loop" error when running Langflow version 1.0.19.post2 on Mac with Python 3.10, you should set the environment variable OBJC_DISABLE_INITIALIZE_FORK_SAFETY to YES. This is necessary to avoid errors when running gunicorn on MacOS. You can do this by adding the following code to your script or setting it in your environment before running the application:

import os
os.environ["OBJC_DISABLE_INITIALIZE_FORK_SAFETY"] = "YES"

Additionally, set the no_proxy environment variable to * to avoid errors with gunicorn:

os.environ["no_proxy"] = "*"

These settings are specifically mentioned in the set_var_for_macos_issue function in the Langflow code, which is designed to address this issue on MacOS [1][2].

To continue talking to Dosu, mention @dosu.