Find answers from the community

Updated 12 months ago

llama-index 0.10.19+ has the following

At a glance

The community member is experiencing issues with the llama-index 0.10.19+ library, specifically with the PostgresDocumentStore and PostgresIndexStore classes. The errors are related to a missing module, llama_index.storage.kvstore, which is required by these classes. The community member suggests that fixing the bad imports allows the function to run, but they are unsure if there are any other issues with the PostgresDocumentStore and PostgresIndexStore classes.

In the comments, another community member suggests that the issue is just missing a dependency, and recommends installing the llama-index-storage-kvstore-postgres package to resolve the problem. The community members agree that this is an easy fix and suggest submitting a pull request (PR) to address the issue.

llama-index 0.10.19+ has the following errors (I haven't checked prior versions)
Plain Text
def get_pg_storage_context():
    from llama_index.storage.docstore.postgres import PostgresDocumentStore
    from llama_index.storage.index_store.postgres import PostgresIndexStore
    from llama_index.vector_stores.postgres import PGVectorStore

    storage_context = StorageContext.from_defaults(
        docstore=PostgresDocumentStore.from_uri(uri="postgres://....."),
        index_store=PostgresIndexStore.from_uri="postgres://..."),
        vector_store=PGVectorStore.from_uri="postgres://...",
    )
    return storage_context

this raises the following exceptions for docstore and indexstore:
Plain Text
File ~/.virtualenvs/grizzly_3.10/lib/python3.10/site-packages/llama_index/storage/docstore/postgres/base.py:5
      3 from llama_index.core.storage.docstore.keyval_docstore import KVDocumentStore
      4 from llama_index.core.storage.docstore.types import DEFAULT_BATCH_SIZE
----> 5 from llama_index.storage.kvstore.postgres import PostgresKVStore

ModuleNotFoundError: No module named 'llama_index.storage.kvstore'

same issue with: llama_index/storage/index_store/postgres/base.py:4

the location of PostgresKVStore is at from llama_index.core.storage.kvstore.postgres_kvstore import PostgresKVStore
Fixing the bad imports allows the function above to run, but I don't know if there is anything else wrong w PostgresDocumentStore and PostgresIndexStore. Should I submit a PR for this?
L
h
4 comments
Its just missing a dep
pip install llama-index-storage-kvstore-postgres
@Logan M thanks for merging my PR quickly, I needed it
Add a reply
Sign up and join the conversation on Discord