[GH-ISSUE #23942] bug: Missing greenlet dependency causes startup crash when installed via uvx #58786

Open
opened 2026-05-05 23:55:39 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @tooke24 on GitHub (Apr 21, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23942

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items.
  • I am using the latest version of Open WebUI.

Installation Method

uvx (ephemeral environment created by uv tool run)

Open WebUI Version

0.9.1

Operating System

macOS 15 (Darwin 25.4.0, aarch64)

Summary

Launching Open WebUI via uvx fails on startup with ValueError: the greenlet library is required to use this function. No module named 'greenlet'. SQLAlchemy's async code path is reached during the lifespan hook (install_tool_and_function_dependenciesFunctions.get_functions), and greenlet is not in the resolved environment.

The pip/Docker install paths seem to get greenlet indirectly (probably via another transitive dep), but uvx produces a minimal environment where that indirect inclusion doesn't happen — so the latent packaging gap becomes a hard crash.

Reproduction

DATA_DIR=~/.open-webui uvx --python 3.11 open-webui@latest serve

Error Stack Trace (abridged)

File ".../open_webui/models/functions.py", line 225, in get_functions
    result = await db.execute(select(Function).filter_by(is_active=True))
File ".../sqlalchemy/ext/asyncio/session.py", line 449, in execute
    result = await greenlet_spawn(...)
File ".../sqlalchemy/util/concurrency.py", line 101, in greenlet_spawn
    _not_implemented()
File ".../sqlalchemy/util/concurrency.py", line 81, in _not_implemented
    raise ValueError(...)
ValueError: the greenlet library is required to use this function. No module named 'greenlet'

Application startup failed. Exiting.

Workaround

Add greenlet explicitly to the uvx invocation:

DATA_DIR=~/.open-webui uvx --python 3.11 --with greenlet open-webui@latest serve

After this, startup completes cleanly (scheduler starts, no stack trace).

Suggested Fix

In pyproject.toml, either:

  1. Change the SQLAlchemy dependency to include its async extra:

    sqlalchemy[asyncio]>=X.Y.Z
    

    which transitively pulls in greenlet; or

  2. Add greenlet as a direct dependency.

Option 1 is the more conventional SQLAlchemy-recommended form.

Additional context

The lifespan hook performs async DB queries, so any clean, minimal environment without greenlet will hit this. Docker and many pip installs happen to have greenlet pulled in as a side effect of other deps, hiding the bug. uvx (and any other strict resolver) surfaces it.

Originally created by @tooke24 on GitHub (Apr 21, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/23942 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items. - [x] I am using the latest version of Open WebUI. ### Installation Method `uvx` (ephemeral environment created by `uv tool run`) ### Open WebUI Version 0.9.1 ### Operating System macOS 15 (Darwin 25.4.0, aarch64) ### Summary Launching Open WebUI via `uvx` fails on startup with `ValueError: the greenlet library is required to use this function. No module named 'greenlet'`. SQLAlchemy's async code path is reached during the `lifespan` hook (`install_tool_and_function_dependencies` → `Functions.get_functions`), and greenlet is not in the resolved environment. The `pip`/Docker install paths seem to get greenlet indirectly (probably via another transitive dep), but `uvx` produces a minimal environment where that indirect inclusion doesn't happen — so the latent packaging gap becomes a hard crash. ### Reproduction ```bash DATA_DIR=~/.open-webui uvx --python 3.11 open-webui@latest serve ``` ### Error Stack Trace (abridged) ``` File ".../open_webui/models/functions.py", line 225, in get_functions result = await db.execute(select(Function).filter_by(is_active=True)) File ".../sqlalchemy/ext/asyncio/session.py", line 449, in execute result = await greenlet_spawn(...) File ".../sqlalchemy/util/concurrency.py", line 101, in greenlet_spawn _not_implemented() File ".../sqlalchemy/util/concurrency.py", line 81, in _not_implemented raise ValueError(...) ValueError: the greenlet library is required to use this function. No module named 'greenlet' Application startup failed. Exiting. ``` ### Workaround Add greenlet explicitly to the uvx invocation: ```bash DATA_DIR=~/.open-webui uvx --python 3.11 --with greenlet open-webui@latest serve ``` After this, startup completes cleanly (scheduler starts, no stack trace). ### Suggested Fix In `pyproject.toml`, either: 1. Change the SQLAlchemy dependency to include its async extra: ``` sqlalchemy[asyncio]>=X.Y.Z ``` which transitively pulls in `greenlet`; **or** 2. Add `greenlet` as a direct dependency. Option 1 is the more conventional SQLAlchemy-recommended form. ### Additional context The `lifespan` hook performs async DB queries, so any clean, minimal environment without greenlet will hit this. Docker and many `pip` installs happen to have greenlet pulled in as a side effect of other deps, hiding the bug. `uvx` (and any other strict resolver) surfaces it.
Author
Owner

@Classic298 commented on GitHub (Apr 21, 2026):

Thanks for the detailed report. Quick workaround while this gets addressed properly:

uvx --python 3.11 --with greenlet open-webui@latest serve

Why this happens only on uvx: SQLAlchemy 2.x's async path requires greenlet, but we currently declare plain sqlalchemy in pyproject.toml without the [asyncio] extra. On Docker and most pip installs, greenlet gets pulled in transitively by other dependencies (chromadb/posthog chain, etc.), so the missing declaration is invisible. uvx creates a strict, minimal environment without those incidental transitive deps, so it surfaces the gap as a hard crash.

Proper fix on our end is to change the dependency to sqlalchemy[asyncio], which transitively pulls greenlet in.

<!-- gh-comment-id:4289377775 --> @Classic298 commented on GitHub (Apr 21, 2026): Thanks for the detailed report. Quick workaround while this gets addressed properly: uvx --python 3.11 --with greenlet open-webui@latest serve Why this happens only on uvx: SQLAlchemy 2.x's async path requires greenlet, but we currently declare plain sqlalchemy in pyproject.toml without the [asyncio] extra. On Docker and most pip installs, greenlet gets pulled in transitively by other dependencies (chromadb/posthog chain, etc.), so the missing declaration is invisible. uvx creates a strict, minimal environment without those incidental transitive deps, so it surfaces the gap as a hard crash. Proper fix on our end is to change the dependency to sqlalchemy[asyncio], which transitively pulls greenlet in.
Author
Owner

@mdouglas4321-svg commented on GitHub (Apr 22, 2026):

uvx --python 3.11 --with greenlet open-webui@latest serve overwrote erased my users, history, etc, and made me start over as a new install, I don't recommend.

<!-- gh-comment-id:4292901306 --> @mdouglas4321-svg commented on GitHub (Apr 22, 2026): uvx --python 3.11 --with greenlet open-webui@latest serve overwrote erased my users, history, etc, and made me start over as a new install, I don't recommend.
Author
Owner

@csloz commented on GitHub (Apr 22, 2026):

Same issue with a fresh install with uv pip install open-webui as per https://www.jjude.com/tech-notes/run-owui-on-mac/

tail webui.log
File "/Users/ent/openwebui/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/session.py", line 1016, in close
await greenlet_spawn(self.sync_session.close)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ent/openwebui/.venv/lib/python3.11/site-packages/sqlalchemy/util/concurrency.py", line 101, in greenlet_spawn
_not_implemented()
File "/Users/ent/openwebui/.venv/lib/python3.11/site-packages/sqlalchemy/util/concurrency.py", line 81, in _not_implemented
raise ValueError(
ValueError: the greenlet library is required to use this function. No module named 'greenlet'

running the obvious fixed it for me, but its a new clean install, so no users to nuke

uv pip install greenlet

<!-- gh-comment-id:4293200261 --> @csloz commented on GitHub (Apr 22, 2026): Same issue with a fresh install with uv pip install open-webui as per https://www.jjude.com/tech-notes/run-owui-on-mac/ tail webui.log File "/Users/ent/openwebui/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/session.py", line 1016, in close await greenlet_spawn(self.sync_session.close) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/ent/openwebui/.venv/lib/python3.11/site-packages/sqlalchemy/util/concurrency.py", line 101, in greenlet_spawn _not_implemented() File "/Users/ent/openwebui/.venv/lib/python3.11/site-packages/sqlalchemy/util/concurrency.py", line 81, in _not_implemented raise ValueError( ValueError: the greenlet library is required to use this function. No module named 'greenlet' running the obvious fixed it for me, but its a new clean install, so no users to nuke uv pip install greenlet
Author
Owner

@Classic298 commented on GitHub (Apr 22, 2026):

@mdouglas4321-svg well you have to add your data dir etc. of course. The above is a sample command - one which is evidently missing any information on the data directory or other environment vars

<!-- gh-comment-id:4294089551 --> @Classic298 commented on GitHub (Apr 22, 2026): @mdouglas4321-svg well you have to add your data dir etc. of course. The above is a sample command - one which is evidently missing any information on the data directory or other environment vars
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#58786