[GH-ISSUE #24152] issue: v0.9.2 fails to start on Windows venv with PostgreSQL: Psycopg cannot use ProactorEventLoop #107203

Open
opened 2026-05-18 05:52:55 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @Rooster-Fighter on GitHub (Apr 26, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24152

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 (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Pip Install

Open WebUI Version

v0.9.2

Ollama Version (if applicable)

0.21.2

Operating System

Windows 11 Home 26200.8246 ja-JP

Browser (if applicable)

Firefox 150.0

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

Open Web UI won't startup after update v 0.9.2

Actual Behavior

Windows: Psycopg cannot use the 'ProactorEventLoop' to run in async mode.

Steps to Reproduce

Create a virtual environment and install latest Open WebUI via pip:
pip install open-webui
and setting postgress DB configuration.
after that.
simply on venv
put "open-webui serve"

Logs & Screenshots

(openwebui) F:\gpt\openwebui>open-webui serve
Active code page: 65001
Loading WEBUI_SECRET_KEY from file, not provided as an environment variable.
Loading WEBUI_SECRET_KEY from F:\gpt\openwebui.webui_secret_key
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
WARNI [open_webui.env] ⚠️ SECURITY WARNING: JWT_EXPIRES_IN is set to '-1'
See: https://docs.openwebui.com/reference/env-configuration

WARNI [open_webui.env]

WARNING: CORS_ALLOW_ORIGIN IS SET TO '*' - NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS.

WARNI [langchain_community.utils.user_agent] USER_AGENT environment variable not set, consider setting it to identify your requests.

██████╗ ██████╗ ███████╗███╗ ██╗ ██╗ ██╗███████╗██████╗ ██╗ ██╗██╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║ ██║ ██║██╔════╝██╔══██╗██║ ██║██║
██║ ██║██████╔╝█████╗ ██╔██╗ ██║ ██║ █╗ ██║█████╗ ██████╔╝██║ ██║██║
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║███╗██║██╔══╝ ██╔══██╗██║ ██║██║
╚█████���╔╝██║ ███████╗██║ ╚████║ ╚███╔███╔╝███████╗██████╔╝╚██████╔╝██║
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚══╝╚══╝ ╚══════╝╚═════╝ ╚═════╝ ╚═╝

v0.9.2 - building the best AI user interface.

https://github.com/open-webui/open-webui

Fetching 30 files: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 30/30 [00:00<00:00, 12970.74it/s]
Download complete: : 0.00B [00:00, ?B/s] | 0/30 [00:00<?, ?it/s]
Loading weights: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 103/103 [00:00<00:00, 7515.10it/s]
BertModel LOAD REPORT from: C:\Users\XXXX.cache\huggingface\hub\models--sentence-transformers--all-MiniLM-L6-v2\snapshots\c9745ed1d9f207416be6d2e6f8de32d1f16199bf
Key | Status | Details
------------------------+------------+--------
embeddings.position_ids | UNEXPECTED |

Notes:

  • UNEXPECTED: can be ignored when loading from different task/architecture; not ok if you expect identical arch.
    INFO: Started server process [22712]
    INFO: Waiting for application startup.
    2026-04-26 16:49:54.739 | INFO | open_webui.utils.logger:start_logger:194 - GLOBAL_LOG_LEVEL: INFO
    2026-04-26 16:49:54.739 | INFO | open_webui.main:lifespan:659 - Installing external dependencies of functions and tools...
    Traceback (most recent call last):
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 143, in init
    self._dbapi_connection = engine.raw_connection()
    ^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 3317, in raw_connection
    return self.pool.connect()
    ^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout
    rec = pool._do_get()
    ^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get
    with util.safe_reraise():
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in exit
    raise exc_value.with_traceback(exc_tb)
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\impl.py", line 175, in _do_get
    return self._create_connection()
    ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
    ^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in init
    self.__connect()
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect
    with util.safe_reraise():
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in exit
    raise exc_value.with_traceback(exc_tb)
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect
    return dialect.connect(*cargs_tup, **cparams)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\dialects\postgresql\psycopg.py", line 812, in connect
    await_only(creator_fn(*arg, **kw))
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 132, in await_only
    return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 196, in greenlet_spawn
    value = await result
    ^^^^^^^^^^^^
    File "F:\gpt\openwebui\Lib\site-packages\psycopg\connection_async.py", line 104, in connect
    raise e.InterfaceError(
    psycopg.InterfaceError: Psycopg cannot use the 'ProactorEventLoop' to run in async mode. Please use a compatible event loop, for instance by setting 'asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "F:\gpt\openwebui\Lib\site-packages\starlette\routing.py", line 694, in lifespan
async with self.lifespan_context(app) as maybe_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan
async with original_context(app) as maybe_original_state:
File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\open_webui\main.py", line 660, in lifespan
await install_tool_and_function_dependencies()
File "F:\gpt\openwebui\Lib\site-packages\open_webui\utils\plugin.py", line 418, in install_tool_and_function_dependencies
function_list = await Functions.get_functions(active_only=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\open_webui\models\functions.py", line 225, in get_functions
result = await db.execute(select(Function).filter_by(is_active=True))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 449, in execute
result = await greenlet_spawn(
^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 201, in greenlet_spawn
result = context.throw(*sys.exc_info())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\session.py", line 2351, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\session.py", line 2239, in _execute_internal
conn = self._connection_for_bind(bind)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\session.py", line 2108, in _connection_for_bind
return trans._connection_for_bind(engine, execution_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 2, in _connection_for_bind
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go
ret_value = fn(self, *arg, **kw)
^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\session.py", line 1187, in _connection_for_bind
conn = bind.connect()
^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 3293, in connect
return self._connection_cls(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 145, in init
Connection._handle_dbapi_exception_noconnection(
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 2448, in _handle_dbapi_exception_noconnection
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 143, in init
self._dbapi_connection = engine.raw_connection()
^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 3317, in raw_connection
return self.pool.connect()
^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect
return _ConnectionFairy._checkout(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout
fairy = _ConnectionRecord.checkout(pool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout
rec = pool._do_get()
^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get
with util.safe_reraise():
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in exit
raise exc_value.with_traceback(exc_tb)
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\impl.py", line 175, in _do_get
return self._create_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection
return _ConnectionRecord(self)
^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in init
self.__connect()
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect
with util.safe_reraise():
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in exit
raise exc_value.with_traceback(exc_tb)
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect
return dialect.connect(*cargs_tup, **cparams)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect
return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\dialects\postgresql\psycopg.py", line 812, in connect
await_only(creator_fn(*arg, **kw))
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 132, in await_only
return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 196, in greenlet_spawn
value = await result
^^^^^^^^^^^^
File "F:\gpt\openwebui\Lib\site-packages\psycopg\connection_async.py", line 104, in connect
raise e.InterfaceError(
sqlalchemy.exc.InterfaceError: (psycopg.InterfaceError) Psycopg cannot use the 'ProactorEventLoop' to run in async mode. Please use a compatible event loop, for instance by setting 'asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())'
(Background on this error at: https://sqlalche.me/e/20/rvf5)

Application startup failed. Exiting.

(openwebui) F:\gpt\openwebui>

Additional Information

I rolled back to v0.9.1 and it is working again.

This issue does not occur on v0.9.1 under the same environment and database configuration.

I also checked the release notes and noticed the database driver change:

Changed
⚙️ psycopg v3 async driver. The async database driver has been migrated from asyncpg to psycopg (v3). This is a transparent change for most deployments, but custom connection strings with asyncpg-specific parameters may need adjustment.

Originally created by @Rooster-Fighter on GitHub (Apr 26, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/24152 ### 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 (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Pip Install ### Open WebUI Version v0.9.2 ### Ollama Version (if applicable) 0.21.2 ### Operating System Windows 11 Home 26200.8246 ja-JP ### Browser (if applicable) Firefox 150.0 ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior Open Web UI won't startup after update v 0.9.2 ### Actual Behavior Windows: Psycopg cannot use the 'ProactorEventLoop' to run in async mode. ### Steps to Reproduce Create a virtual environment and install latest Open WebUI via pip: pip install open-webui and setting postgress DB configuration. after that. simply on venv put "open-webui serve" ### Logs & Screenshots (openwebui) F:\gpt\openwebui>open-webui serve Active code page: 65001 Loading WEBUI_SECRET_KEY from file, not provided as an environment variable. Loading WEBUI_SECRET_KEY from F:\gpt\openwebui\.webui_secret_key INFO [alembic.runtime.migration] Context impl PostgresqlImpl. INFO [alembic.runtime.migration] Will assume transactional DDL. WARNI [open_webui.env] ⚠️ SECURITY WARNING: JWT_EXPIRES_IN is set to '-1' See: https://docs.openwebui.com/reference/env-configuration WARNI [open_webui.env] WARNING: CORS_ALLOW_ORIGIN IS SET TO '*' - NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS. WARNI [langchain_community.utils.user_agent] USER_AGENT environment variable not set, consider setting it to identify your requests. ██████╗ ██████╗ ███████╗███╗ ██╗ ██╗ ██╗███████╗██████╗ ██╗ ██╗██╗ ██╔═══██╗██╔══██╗██╔════╝████╗ ██║ ██║ ██║██╔════╝██╔══██╗██║ ██║██║ ██║ ██║██████╔╝█████╗ ██╔██╗ ██║ ██║ █╗ ██║█████╗ ██████╔╝██║ ██║██║ ██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║███╗██║██╔══╝ ██╔══██╗██║ ██║██║ ╚█████���╔╝██║ ███████╗██║ ╚████║ ╚███╔███╔╝███████╗██████╔╝╚██████╔╝██║ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚══╝╚══╝ ╚══════╝╚═════╝ ╚═════╝ ╚═╝ v0.9.2 - building the best AI user interface. https://github.com/open-webui/open-webui Fetching 30 files: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 30/30 [00:00<00:00, 12970.74it/s] Download complete: : 0.00B [00:00, ?B/s] | 0/30 [00:00<?, ?it/s] Loading weights: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 103/103 [00:00<00:00, 7515.10it/s] BertModel LOAD REPORT from: C:\Users\XXXX\.cache\huggingface\hub\models--sentence-transformers--all-MiniLM-L6-v2\snapshots\c9745ed1d9f207416be6d2e6f8de32d1f16199bf Key | Status | Details ------------------------+------------+-------- embeddings.position_ids | UNEXPECTED | Notes: - UNEXPECTED: can be ignored when loading from different task/architecture; not ok if you expect identical arch. INFO: Started server process [22712] INFO: Waiting for application startup. 2026-04-26 16:49:54.739 | INFO | open_webui.utils.logger:start_logger:194 - GLOBAL_LOG_LEVEL: INFO 2026-04-26 16:49:54.739 | INFO | open_webui.main:lifespan:659 - Installing external dependencies of functions and tools... Traceback (most recent call last): File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 143, in __init__ self._dbapi_connection = engine.raw_connection() ^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 3317, in raw_connection return self.pool.connect() ^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect return _ConnectionFairy._checkout(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout fairy = _ConnectionRecord.checkout(pool) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout rec = pool._do_get() ^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get with util.safe_reraise(): File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in __exit__ raise exc_value.with_traceback(exc_tb) File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\impl.py", line 175, in _do_get return self._create_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection return _ConnectionRecord(self) ^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ self.__connect() File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect with util.safe_reraise(): File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in __exit__ raise exc_value.with_traceback(exc_tb) File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect self.dbapi_connection = connection = pool._invoke_creator(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect return dialect.connect(*cargs_tup, **cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\dialects\postgresql\psycopg.py", line 812, in connect await_only(creator_fn(*arg, **kw)) File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn value = await result ^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\psycopg\connection_async.py", line 104, in connect raise e.InterfaceError( psycopg.InterfaceError: Psycopg cannot use the 'ProactorEventLoop' to run in async mode. Please use a compatible event loop, for instance by setting 'asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\gpt\openwebui\Lib\site-packages\starlette\routing.py", line 694, in lifespan async with self.lifespan_context(app) as maybe_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\fastapi\routing.py", line 212, in merged_lifespan async with original_context(app) as maybe_original_state: File "C:\Users\silen\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 210, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\open_webui\main.py", line 660, in lifespan await install_tool_and_function_dependencies() File "F:\gpt\openwebui\Lib\site-packages\open_webui\utils\plugin.py", line 418, in install_tool_and_function_dependencies function_list = await Functions.get_functions(active_only=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\open_webui\models\functions.py", line 225, in get_functions result = await db.execute(select(Function).filter_by(is_active=True)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 449, in execute result = await greenlet_spawn( ^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn result = context.throw(*sys.exc_info()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\session.py", line 2351, in execute return self._execute_internal( ^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\session.py", line 2239, in _execute_internal conn = self._connection_for_bind(bind) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\session.py", line 2108, in _connection_for_bind return trans._connection_for_bind(engine, execution_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<string>", line 2, in _connection_for_bind File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go ret_value = fn(self, *arg, **kw) ^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\orm\session.py", line 1187, in _connection_for_bind conn = bind.connect() ^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 3293, in connect return self._connection_cls(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 145, in __init__ Connection._handle_dbapi_exception_noconnection( File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 2448, in _handle_dbapi_exception_noconnection raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 143, in __init__ self._dbapi_connection = engine.raw_connection() ^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\base.py", line 3317, in raw_connection return self.pool.connect() ^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect return _ConnectionFairy._checkout(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout fairy = _ConnectionRecord.checkout(pool) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout rec = pool._do_get() ^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get with util.safe_reraise(): File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in __exit__ raise exc_value.with_traceback(exc_tb) File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\impl.py", line 175, in _do_get return self._create_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection return _ConnectionRecord(self) ^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ self.__connect() File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect with util.safe_reraise(): File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in __exit__ raise exc_value.with_traceback(exc_tb) File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect self.dbapi_connection = connection = pool._invoke_creator(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect return dialect.connect(*cargs_tup, **cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\dialects\postgresql\psycopg.py", line 812, in connect await_only(creator_fn(*arg, **kw)) File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn value = await result ^^^^^^^^^^^^ File "F:\gpt\openwebui\Lib\site-packages\psycopg\connection_async.py", line 104, in connect raise e.InterfaceError( sqlalchemy.exc.InterfaceError: (psycopg.InterfaceError) Psycopg cannot use the 'ProactorEventLoop' to run in async mode. Please use a compatible event loop, for instance by setting 'asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())' (Background on this error at: https://sqlalche.me/e/20/rvf5) Application startup failed. Exiting. (openwebui) F:\gpt\openwebui> ### Additional Information I rolled back to v0.9.1 and it is working again. This issue does not occur on v0.9.1 under the same environment and database configuration. I also checked the release notes and noticed the database driver change: Changed ⚙️ psycopg v3 async driver. The async database driver has been migrated from asyncpg to psycopg (v3). This is a transparent change for most deployments, but custom connection strings with asyncpg-specific parameters may need adjustment.
GiteaMirror added the bug label 2026-05-18 05:52:55 -05:00
Author
Owner

@rgaricano commented on GitHub (Apr 26, 2026):

are you tried with pip install open-webui[postgres] or pip install open-webui[all]?
(for install it with pycopg & pgvector libs)

I see that that libs isn't updated to use psycopg v3:
https://github.com/open-webui/open-webui/blob/8dae237a0bfdac4b7f55b463b3e2769ea4b94a0b/pyproject.toml#L139-L152

psycopg2-binary should be updated to: psycopg[binary]==3.3.3

<!-- gh-comment-id:4321687038 --> @rgaricano commented on GitHub (Apr 26, 2026): are you tried with `pip install open-webui[postgres]` or `pip install open-webui[all]`? (for install it with pycopg & pgvector libs) I see that that libs isn't updated to use psycopg v3: https://github.com/open-webui/open-webui/blob/8dae237a0bfdac4b7f55b463b3e2769ea4b94a0b/pyproject.toml#L139-L152 `psycopg2-binary` should be updated to: `psycopg[binary]==3.3.3`
Author
Owner

@Rooster-Fighter commented on GitHub (Apr 26, 2026):

Thank you for response.

Up to v0.9.1, I had been using:

pip install open-webui

For this issue, it first appeared after upgrading with:

pip install -U open-webui

As you suggested, I also tested with:

pip install -U "open-webui[postgres]"

The result was the same error. I am attaching the log output.
log260426.txt

So the issue still occurs even with the PostgreSQL extras installed.

<!-- gh-comment-id:4322031584 --> @Rooster-Fighter commented on GitHub (Apr 26, 2026): Thank you for response. Up to v0.9.1, I had been using: pip install open-webui For this issue, it first appeared after upgrading with: pip install -U open-webui As you suggested, I also tested with: pip install -U "open-webui[postgres]" The result was the same error. I am attaching the log output. [log260426.txt](https://github.com/user-attachments/files/27099431/log260426.txt) So the issue still occurs even with the PostgreSQL extras installed.
Author
Owner

@Rooster-Fighter commented on GitHub (Apr 26, 2026):

@rgaricano

are you tried with pip install open-webui[postgres] or pip install open-webui[all]? (for install it with pycopg & pgvector libs)

I see that that libs isn't updated to use psycopg v3:

open-webui/pyproject.toml

Lines 139 to 152 in 8dae237
postgres = [
"psycopg2-binary==2.9.11",
"pgvector==0.4.2",
]
mariadb = [
"mariadb==1.1.14",
]
unstructured = [
"unstructured==0.18.31",
]

all = [
"pymongo==4.16.0",
"psycopg2-binary==2.9.11",

psycopg2-binary should be updated to: psycopg[binary]==3.3.3

I tried install psycopg[binary]==3.3.3
but same result. attech log.

log260426_2.txt

<!-- gh-comment-id:4322314685 --> @Rooster-Fighter commented on GitHub (Apr 26, 2026): @rgaricano > are you tried with `pip install open-webui[postgres]` or `pip install open-webui[all]`? (for install it with pycopg & pgvector libs) > > I see that that libs isn't updated to use psycopg v3: > > [open-webui/pyproject.toml](https://github.com/open-webui/open-webui/blob/8dae237a0bfdac4b7f55b463b3e2769ea4b94a0b/pyproject.toml#L139-L152) > > Lines 139 to 152 in [8dae237](/open-webui/open-webui/commit/8dae237a0bfdac4b7f55b463b3e2769ea4b94a0b) > postgres = [ > "psycopg2-binary==2.9.11", > "pgvector==0.4.2", > ] > mariadb = [ > "mariadb==1.1.14", > ] > unstructured = [ > "unstructured==0.18.31", > ] > > all = [ > "pymongo==4.16.0", > "psycopg2-binary==2.9.11", > > `psycopg2-binary` should be updated to: `psycopg[binary]==3.3.3` I tried install psycopg[binary]==3.3.3 but same result. attech log. [log260426_2.txt](https://github.com/user-attachments/files/27101195/log260426_2.txt)
Author
Owner

@rgaricano commented on GitHub (Apr 27, 2026):

It seem that it's an issue of psycopg & windows: https://www.psycopg.org/psycopg3/docs/advanced/async.html#async

Warning

On Windows, Psycopg is not compatible with the default [ProactorEventLoop](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.ProactorEventLoop). Please use a different loop, for instance the [SelectorEventLoop](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.SelectorEventLoop). See [asyncio documentation](https://docs.python.org/3.14/library/asyncio-eventloop.html#asyncio.SelectorEventLoop) for details.

Workaround:
https://github.com/psycopg/psycopg/discussions/233#discussioncomment-2234054

import asyncio
import sys

import psycopg


async def main():

    async with await psycopg.AsyncConnection.connect('postgresql://xxxxxxxxxxxxx') as con:
        async with con.cursor() as cur:
            print(await (await cur.execute('select 1 a')).fetchall())

if __name__ == '__main__':

    if sys.platform == "win32":
        asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

    asyncio.run(main())
<!-- gh-comment-id:4324960111 --> @rgaricano commented on GitHub (Apr 27, 2026): It seem that it's an issue of psycopg & windows: https://www.psycopg.org/psycopg3/docs/advanced/async.html#async ``` Warning On Windows, Psycopg is not compatible with the default [ProactorEventLoop](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.ProactorEventLoop). Please use a different loop, for instance the [SelectorEventLoop](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.SelectorEventLoop). See [asyncio documentation](https://docs.python.org/3.14/library/asyncio-eventloop.html#asyncio.SelectorEventLoop) for details. ``` Workaround: https://github.com/psycopg/psycopg/discussions/233#discussioncomment-2234054 ``` import asyncio import sys import psycopg async def main(): async with await psycopg.AsyncConnection.connect('postgresql://xxxxxxxxxxxxx') as con: async with con.cursor() as cur: print(await (await cur.execute('select 1 a')).fetchall()) if __name__ == '__main__': if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.run(main()) ```
Author
Owner

@taka817123 commented on GitHub (Apr 28, 2026):

FYI: the WindowsSelectorEventLoopPolicy workaround alone doesn't fix this when running under uvicorn. uvicorn on Windows ignores the loop policy and instantiates ProactorEventLoop directly via its hardcoded factory (uvicorn/loops/asyncio.py), so psycopg async still fails.

I also needed to monkey-patch uvicorn's loop factory before uvicorn.run() — e.g. in backend/open_webui/__init__.py:

            os.environ['LD_LIBRARY_PATH'] = ':'.join(LD_LIBRARY_PATH)

    #patch from
    import asyncio
    import sys
    # psycopg (v3) async mode requires SelectorEventLoop on Windows.
    # Must be set BEFORE importing open_webui.main (db.py creates async_engine at import time).
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

    # uvicorn on Windows hardcodes ProactorEventLoop in its built-in loop factory,
    # ignoring the event loop policy. Monkey-patch the factory so psycopg async works.
    if sys.platform == "win32":
        def _selector_loop_factory(use_subprocess: bool = False):
            return asyncio.SelectorEventLoop
        import uvicorn.loops.asyncio as _uv_asyncio_loop
        import uvicorn.loops.auto as _uv_auto_loop
        _uv_asyncio_loop.asyncio_loop_factory = _selector_loop_factory
        _uv_auto_loop.auto_loop_factory = _selector_loop_factory
    #patch to

    import open_webui.main  # noqa: F401
    from open_webui.env import UVICORN_WORKERS  # Import the workers setting

With this, Open WebUI v0.9.2 starts cleanly on Windows11 with postgresql+psycopg://. Also, pyproject.toml should bump psycopg2-binary → psycopg[binary]>=3.3 for the [postgres]/[all] extras.> import asyncio, sys

<!-- gh-comment-id:4336307770 --> @taka817123 commented on GitHub (Apr 28, 2026): FYI: the WindowsSelectorEventLoopPolicy workaround alone doesn't fix this when running under uvicorn. uvicorn on Windows ignores the loop policy and instantiates ProactorEventLoop directly via its hardcoded factory (uvicorn/loops/asyncio.py), so psycopg async still fails. I also needed to monkey-patch uvicorn's loop factory before uvicorn.run() — e.g. in backend/open_webui/__init__.py: ```python os.environ['LD_LIBRARY_PATH'] = ':'.join(LD_LIBRARY_PATH) #patch from import asyncio import sys # psycopg (v3) async mode requires SelectorEventLoop on Windows. # Must be set BEFORE importing open_webui.main (db.py creates async_engine at import time). asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # uvicorn on Windows hardcodes ProactorEventLoop in its built-in loop factory, # ignoring the event loop policy. Monkey-patch the factory so psycopg async works. if sys.platform == "win32": def _selector_loop_factory(use_subprocess: bool = False): return asyncio.SelectorEventLoop import uvicorn.loops.asyncio as _uv_asyncio_loop import uvicorn.loops.auto as _uv_auto_loop _uv_asyncio_loop.asyncio_loop_factory = _selector_loop_factory _uv_auto_loop.auto_loop_factory = _selector_loop_factory #patch to import open_webui.main # noqa: F401 from open_webui.env import UVICORN_WORKERS # Import the workers setting ``` With this, Open WebUI v0.9.2 starts cleanly on Windows11 with postgresql+psycopg://. Also, pyproject.toml should bump psycopg2-binary → psycopg[binary]>=3.3 for the [postgres]/[all] extras.> import asyncio, sys
Author
Owner

@tjbck commented on GitHub (May 8, 2026):

Likely addressed in dev, with that being said Windows is absolutely not recommended for any production deployements.

<!-- gh-comment-id:4408569587 --> @tjbck commented on GitHub (May 8, 2026): Likely addressed in dev, with that being said Windows is absolutely not recommended for any production deployements.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#107203