From 48c2fb0d24e50fc390efc291e13ace5d3a04de2c Mon Sep 17 00:00:00 2001 From: James Westbrook Date: Thu, 30 Jan 2025 13:32:11 -0700 Subject: [PATCH] fix: Add error catching for function pip install issues --- backend/open_webui/utils/plugin.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/utils/plugin.py b/backend/open_webui/utils/plugin.py index 17b86cea1..d6e24d6b9 100644 --- a/backend/open_webui/utils/plugin.py +++ b/backend/open_webui/utils/plugin.py @@ -167,9 +167,14 @@ def load_function_module_by_id(function_id, content=None): def install_frontmatter_requirements(requirements): if requirements: - req_list = [req.strip() for req in requirements.split(",")] - for req in req_list: - log.info(f"Installing requirement: {req}") - subprocess.check_call([sys.executable, "-m", "pip", "install", req]) + try: + req_list = [req.strip() for req in requirements.split(",")] + for req in req_list: + log.info(f"Installing requirement: {req}") + subprocess.check_call([sys.executable, "-m", "pip", "install", req]) + except Exception as e: + log.error(f"Error installing package: {req}") + raise e + else: log.info("No requirements found in frontmatter.")