mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[PR #20321] [CLOSED] fix: check requirements via importlib before shelling out to pip #41196
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20321
Author: @fractuscontext
Created: 1/2/2026
Status: ❌ Closed
Base:
dev← Head:fix-importlib📝 Commits (9)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/devd95f533Merge pull request #19729 from open-webui/deva7271530.6.43 (#20093)f54bf11fix: check requirements via importlib before shelling out to pip📊 Changes
1 file changed (+45 additions, -12 deletions)
View changed files
📝
backend/open_webui/utils/plugin.py(+45 -12)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
Description
This PR modifies the
install_frontmatter_requirementsfunction to be smarter about dependency management.Previously, the system would unconditionally run
pip installvia a subprocess for any requirement found in a tool's frontmatter. This caused immediate crashes in environments where directpipusage is restricted or redundant (e.g.,uv,poetry,NixOS), even if the packages were already installed.This fix uses
importlib.metadatato verify if requirements are already satisfied in the current environment before attempting any installation. If packages are missing and the automatic installer fails, it now raises a helpful exception to the UI rather than crashing the backend.Added
importlib.metadatafor existing packages before installation.uvusersChanged
install_frontmatter_requirementsto skipsubprocesscalls if requirements are met.Deprecated
Removed
Fixed
uv/Nixenvironments when loading Tools withrequirementsfrontmatter.pip installattempts for packages that are already present.Security
Breaking Changes
No breaking changes
Additional Information
uvwith Python 3.11.requirements: httpx>=0.24.0resulted insubprocess.CalledProcessError: exit status 1becausepipcannot run inside the locked environment.httpxis already installed (viauv pip install open-webui) and skips the subprocess call, loading the tool successfully.pipfails (due to environment restrictions), the UI now displays: "WARNING: Failed to install dependencies via pip subprocess... please install these packages manually."Screenshots or Videos
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.