letta icon indicating copy to clipboard operation
letta copied to clipboard

sqlalchemy.exc.ProgrammingError: (pg8000.dbapi.ProgrammingError) ... password authentication failed for user "memgpt"

Open boholder opened this issue 9 months ago • 3 comments

Describe the bug

So... here is the full stack trace:

(memgpt) G:\code\ml\memgpt>memgpt run

🧬 Creating new agent...
->  🤖 Using persona profile: 'sam_pov'
->  🧑 Using human profile: 'basic'
Traceback (most recent call last):
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\pg8000\legacy.py", line 443, in __init__
    super().__init__(*args, **kwargs)
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\pg8000\core.py", line 390, in __init__
    raise e
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\pg8000\core.py", line 386, in __init__
    raise context.error
pg8000.exceptions.DatabaseError: {'S': 'FATAL', 'V': 'FATAL', 'C': '28P01', 'M': 'password authentication failed for user "memgpt"', 'F': 'auth.c', 'L': '323', 'R': 'auth_failed'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__
    self._dbapi_connection = engine.raw_connection()
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3304, in raw_connection
    return self.pool.connect()
           ^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 449, in connect
    return _ConnectionFairy._checkout(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1263, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout
    rec = pool._do_get()
          ^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 179, in _do_get
    with util.safe_reraise():
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get
    return self._create_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 390, in _create_connection
    return _ConnectionRecord(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__
    self.__connect()
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect
    with util.safe_reraise():
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 643, in connect
    return dialect.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 617, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\pg8000\__init__.py", line 111, in connect
    return Connection(
           ^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\pg8000\legacy.py", line 456, in __init__
    raise cls(msg)
pg8000.dbapi.ProgrammingError: {'S': 'FATAL', 'V': 'FATAL', 'C': '28P01', 'M': 'password authentication failed for user "memgpt"', 'F': 'auth.c', 'L': '323', 'R': 'auth_failed'}

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

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "G:\code\ml\memgpt\.venv\Scripts\memgpt.exe\__main__.py", line 8, in <module>
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\typer\main.py", line 328, in __call__
    raise e
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\typer\main.py", line 311, in __call__
    return get_command(self)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\typer\core.py", line 783, in main
    return _main(
           ^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\typer\core.py", line 225, in _main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\typer\main.py", line 683, in wrapper
    return callback(**use_params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\memgpt\cli\cli.py", line 693, in run
    memgpt_agent = Agent(
                   ^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\memgpt\agent.py", line 270, in __init__
    self.persistence_manager = LocalStateManager(agent_state=self.agent_state)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\memgpt\persistence_manager.py", line 51, in __init__
    self.archival_memory = EmbeddingArchivalMemory(agent_state)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\memgpt\memory.py", line 383, in __init__
    self.storage = StorageConnector.get_archival_storage_connector(user_id=agent_state.user_id, agent_id=agent_state.id)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\memgpt\agent_store\storage.py", line 120, in get_archival_storage_connector
    return StorageConnector.get_storage_connector(TableType.ARCHIVAL_MEMORY, config, user_id, agent_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\memgpt\agent_store\storage.py", line 97, in get_storage_connector
    return PostgresStorageConnector(table_type, config, user_id, agent_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\memgpt\agent_store\db.py", line 466, in __init__
    session.execute(text("CREATE EXTENSION IF NOT EXISTS vector"))  # Enables the vector extension
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2306, in execute
    return self._execute_internal(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2181, in _execute_internal
    conn = self._connection_for_bind(bind)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2050, in _connection_for_bind
    return trans._connection_for_bind(engine, execution_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 2, in _connection_for_bind
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                ^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1144, in _connection_for_bind
    conn = bind.connect()
           ^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3280, in connect
    return self._connection_cls(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 148, in __init__
    Connection._handle_dbapi_exception_noconnection(
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2444, in _handle_dbapi_exception_noconnection
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__
    self._dbapi_connection = engine.raw_connection()
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3304, in raw_connection
    return self.pool.connect()
           ^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 449, in connect
    return _ConnectionFairy._checkout(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1263, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout
    rec = pool._do_get()
          ^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 179, in _do_get
    with util.safe_reraise():
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get
    return self._create_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 390, in _create_connection
    return _ConnectionRecord(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__
    self.__connect()
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect
    with util.safe_reraise():
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 643, in connect
    return dialect.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 617, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\pg8000\__init__.py", line 111, in connect
    return Connection(
           ^^^^^^^^^^^
  File "G:\code\ml\memgpt\.venv\Lib\site-packages\pg8000\legacy.py", line 456, in __init__
    raise cls(msg)
sqlalchemy.exc.ProgrammingError: (pg8000.dbapi.ProgrammingError) {'S': 'FATAL', 'V': 'FATAL', 'C': '28P01', 'M': 'password authentication failed for user "memgpt"', 'F': 'auth.c', 'L': '323', 'R': 'auth_failed'}
(Background on this error at: https://sqlalche.me/e/20/f405)

Please describe your setup

  • [ ] How did you install memgpt?
    • pip install pymemgpt[local]
  • [ ] Describe your setup
    • OS: Windows
    • Running on: cmd.exe

Screenshots If applicable, add screenshots to help explain your problem.

Additional context

Basically just:

uv venv -p 3.12
(active the venv)
uv pip install pymemgpt[local]
memgpt configure
uv pip install pgvector pg8000
memgpt run

By the way, running memgpt run after memgpt configure will throw exp about missing modules: pgvector, pg8000, so I wonder if this is because the [local] optional dependencies aren't including these two packages.

MemGPT Config

Please attach your ~/.memgpt/config file or copy past it below. Configuration file that generated with memgpt configure:

[defaults]
preset = memgpt_chat
persona = sam_pov
human = basic

[model]
model = qwen:32b-chat-v1.5-q5_K_M
model_endpoint = http://localhost:11434
model_endpoint_type = ollama
model_wrapper = chatml
context_window = 32768

[embedding]
embedding_endpoint_type = local
embedding_model = BAAI/bge-small-en-v1.5
embedding_dim = 384
embedding_chunk_size = 300

[archival_storage]
type = postgres
path = C:\Users\user\.memgpt\chroma
uri = postgresql://localhost:5432/memgpt?user=postgres&password=postgres

[recall_storage]
type = sqlite
path = C:\Users\user\.memgpt

[metadata_storage]
type = sqlite
path = C:\Users\user\.memgpt

[version]
memgpt_version = 0.3.12

[client]
anon_clientid = 00000000-0000-0000-0000-000000000000

If you're not using OpenAI, please provide additional information on your local LLM setup:

Local LLM details

Running ollama through cmd.exe.

If you are trying to run MemGPT with local LLMs, please provide the following information:

  • [ ] The exact model you're trying to use: qwen:32b-chat-v1.5-q5_K_M
  • [ ] The local LLM backend you are using: ollama
  • [ ] Your hardware for the local LLM backend: same machine with memgpt.

boholder avatar Apr 27 '24 14:04 boholder

I confirm I have the same issue.

moriartynz avatar Apr 28 '24 08:04 moriartynz

How are you running postgres? Is it with the script we provide, or do you have your own postgres URI?

sarahwooders avatar May 03 '24 16:05 sarahwooders

How are you running postgres? Is it with the script we provide, or do you have your own postgres URI?

I don't know this project provides pg script, I run it with docker. Now I suddenly realize the problem is that I hadn't initialized the pg with given script. Thanks for your reminder,please add script thing into starter documentation.

boholder avatar May 03 '24 23:05 boholder