LangChain Chat with Your Data: chroma vectorstore does not work with Python 3.10

I’m using the notebooks from

on an Colab-Environment, which runs python 3.10.
there is an issue with the lib hnswlib:

AttributeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 vectordb = Chroma.from_documents(
2 documents=splits,
3 embedding=embedding,
4 persist_directory=persist_directory
5 )

12 frames
/usr/local/lib/python3.10/dist-packages/chromadb/segment/impl/vector/ in get_file_handle_count()
444 def get_file_handle_count() → int:
445 “”“Return how many file handles are used by the index”“”
→ 446 hnswlib_count = hnswlib.Index.file_handle_count
447 hnswlib_count = cast(int, hnswlib_count)
448 # One extra for the metadata file

AttributeError: type object ‘hnswlib.Index’ has no attribute ‘file_handle_count’

this issue has been reported in Git already:
(AttributeError: type object 'hnswlib.Index' has no attribute 'file_handle_count' · Issue #1012 · zylon-ai/private-gpt · GitHub)

But the fix cannot be applied here - it just moves to error to another dependcy.
Any ideas how to fix this?


Hi pietzons, I think you can try to align your python environment (downgrade some packages) with the notebook on the site. I notice that the python used in the class is 3.9.19, and for other packages, you can run “pip list” in the notebook cell to get their version. Adjusting the environment needs some patient. And you can see the “hnswlib” used is 0.7.0.