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
35.77k stars 4.24k forks source link

Unclosed event loop error when running langflow #4436

Open SavvySupport opened 2 weeks ago

SavvySupport commented 2 weeks 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 2 weeks 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.

kkjinping commented 2 weeks ago

ubuntu same error

Cristhianzl commented 1 week ago

hey @kkjinping @SavvySupport

Hi! Thanks for reporting this. We've recently released Langflow v1.1. Could you please:

  1. Update Langflow using:

    pip install langflow -U
  2. Try running it again with:

    langflow run

Let me know if the error persists. If it does, please share the error message so I can help further.

image
romeuow commented 4 days ago

@Cristhianzl version v1.1. is with this issue