mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 01:33:18 -04:00
upgrading from 0.0.6 -> 0.0.9, getting _async_engine not found #34
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?
Originally created by @codekiln on GitHub (Aug 6, 2024).
Log signature:
_async_engine not founderror emerges from
langchain_postgres.vectorstores.PGVector.acreate_vector_extensionI'm trying to call
invoke(), so I don't really understand why it's trying to use the async versionI'm going to downgrade back to 0.0.6 for now.
How I'm instantiating PGVector -
I tried updating the connection string so it used
postgresql+asyncpg://instead ofpostgresql+psycopg://but got a bunch of downstream errors related to module not found, then tried adding these dependencies to pyproject.toml:But at this point, when using langserve I'm not totally certain how to make it instantiate the async version.
Expected Behavior
ainvokeand other methods use the async postgres connection, callinginvokeuses the sync postgres connectionActual Behavior
@Simon-Stone commented on GitHub (Aug 6, 2024):
Ran into the same issue when trying to deploy a chain containing a PGVector vectorstore using LangServe. Downgrading to 0.0.6 helped.
@Benjaminrivard commented on GitHub (Aug 21, 2024):
Hi,
If you actually want to use the async methods with latest version (0.0.9), you could use the following snippet, which uses
create_async_engine(I got it from PR https://github.com/langchain-ai/langchain-postgres/pull/64)Best,
Benjamin
@eyurtsev commented on GitHub (Sep 12, 2024):
LangServe is async by default. So if you're using langserve you should be creating an async engine. This is not a bug in the library -- just bad documentation
@zeusari commented on GitHub (Apr 25, 2025):
While running this in Windows I encountered this exception.
Adding the correct EventLoopPolicy help resolving this. If it helps other below is the code snippet.
Found the solution here:
here
@pavlix98 commented on GitHub (Oct 3, 2025):
Using the latest version (0.0.15), I am still encountering the same problem. A Google search brought me here.
After analyzing the source code, it seems we now have a better option for using PGVector in an async environment—by simply enabling async mode:
I still think it would be helpful to have an error message that describes the issue more clearly, instead of just: