[BUG] chromadb: AttributeError: type object 'hnswlib.Index' has no attribute 'file_handle_count'
Opened this issue · 1 comments
alx commented
Description
A wrongly formatted comment is present on chromadb package, I changed it manually to fix the issue but there should have another way to fix it automatically.
Reproduction steps
1. git clone
2. source .venv/bin/activate
3. uv run python3 app.py
4. error.log
Issue fix: zylon-ai/private-gpt#1012 (comment)
To fix:
5. open .venv/lib/python3.10/site-packages/chromadb/segment/impl/manager/local.py
6. comment line 96 (see line number on error.log) with python style comment format
Logs
(.venv) alx@slim:~/code/kotaemon$ python3 app.py
GraphRAG dependencies not installed. Try `pip install graphrag future` to install. GraphRAG retriever pipeline will not work properly.
LightRAG dependencies not installed. Try `pip install git+https://github.com/HKUDS/LightRAG.git` to install. LighthRAG retriever pipeline will not work properly.
INFO:chromadb.telemetry.product.posthog:Anonymized telemetry enabled. See https://docs.trychroma.com/telemetry for more information.
Traceback (most recent call last):
File "/home/alx/code/kotaemon/app.py", line 15, in <module>
app = App()
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/ktem/app.py", line 73, in __init__
self.initialize_indices()
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/ktem/app.py", line 84, in initialize_indices
self.index_manager.on_application_startup()
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/ktem/index/manager.py", line 193, in on_application_startup
self.start_index(**index_def.model_dump())
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/ktem/index/manager.py", line 106, in start_index
index.on_start()
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/ktem/index/file/index.py", line 336, in on_start
self._setup_resources()
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/ktem/index/file/index.py", line 141, in _setup_resources
self._vs: BaseVectorStore = get_vectorstore(f"index_{self.id}")
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/ktem/components.py", line 36, in get_vectorstore
return deserialize(vs_conf, safe=False)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/theflow/utils/modules.py", line 168, in deserialize
return cls(**params)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/kotaemon/storages/vectorstores/chroma.py", line 43, in __init__
client = chromadb.PersistentClient(path=path)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/__init__.py", line 153, in PersistentClient
return ClientCreator(tenant=tenant, database=database, settings=settings)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/api/client.py", line 58, in __init__
super().__init__(settings=settings)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/api/shared_system_client.py", line 19, in __init__
SharedSystemClient._create_system_if_not_exists(self._identifier, settings)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/api/shared_system_client.py", line 30, in _create_system_if_not_exists
new_system.instance(ServerAPI)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/config.py", line 424, in instance
impl = type(self)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/api/segment.py", line 125, in __init__
self._manager = self.require(SegmentManager)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/config.py", line 317, in require
inst = self._system.instance(type)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/config.py", line 424, in instance
impl = type(self)
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/segment/impl/manager/local.py", line 96, in __init__
// PersistentLocalHnswSegment.get_file_handle_count()
File "/home/alx/code/kotaemon/.venv/lib/python3.10/site-packages/chromadb/segment/impl/vector/local_persistent_hnsw.py", line 527, in get_file_handle_count
hnswlib_count = hnswlib.Index.file_handle_count
AttributeError: type object 'hnswlib.Index' has no attribute 'file_handle_count'
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1733982850.426184 536606 init.cc:229] grpc_wait_for_shutdown_with_timeout() timed out.
varunsharma27 commented
I solved this issue by created my own image:
FROM ghcr.io/cinnamon/kotaemon:main-full
ENV GRADIO_SERVER_NAME 0.0.0.0
ENV GRADIO_SERVER_PORT 8080
ENV NanoGraphRAG true
RUN pip install nano-graphrag
RUN pip uninstall -y hnswlib chroma-hnswlib && pip install chroma-hnswlib
EXPOSE 8080
Alternatively, you may just do this locally:
pip install nano-graphrag
pip uninstall -y hnswlib chroma-hnswlib && pip install chroma-hnswlib