langchain: `ImportError` ChromaDB

Summary

I’m seeing this ImportError on my Mac M1 when trying to use Chroma

(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

Any ideas?

Traceback

Traceback (most recent call last):
  File "/Users/homanp/Library/Caches/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 147, in <module>
    lambda_runtime_main()
  File "/Users/homanp/Library/Caches/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 127, in lambda_runtime_main
    fn = lambda_runtime_get_handler()
  File "/Users/homanp/Library/Caches/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 113, in lambda_runtime_get_handler
    mod = importlib.import_module(module_name)
  File "/opt/homebrew/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/var/folders/b5/g5rvd57j2wq3nysn1n8h66yr0000gn/T/zeit-fun-6d31861b417ef/vc__handler__python.py", line 12, in <module>
    __vc_spec.loader.exec_module(__vc_module)
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/private/var/folders/b5/g5rvd57j2wq3nysn1n8h66yr0000gn/T/zeit-fun-6d31861b417ef/./api/index.py", line 13, in <module>
    index = VectorstoreIndexCreator().from_loaders([loader])
  File "/var/folders/b5/g5rvd57j2wq3nysn1n8h66yr0000gn/T/zeit-fun-6d31861b417ef/langchain/indexes/vectorstore.py", line 71, in from_loaders
    vectorstore = self.vectorstore_cls.from_documents(
  File "/var/folders/b5/g5rvd57j2wq3nysn1n8h66yr0000gn/T/zeit-fun-6d31861b417ef/langchain/vectorstores/chroma.py", line 268, in from_documents
    return cls.from_texts(
  File "/var/folders/b5/g5rvd57j2wq3nysn1n8h66yr0000gn/T/zeit-fun-6d31861b417ef/langchain/vectorstores/chroma.py", line 231, in from_texts
    chroma_collection = cls(
  File "/var/folders/b5/g5rvd57j2wq3nysn1n8h66yr0000gn/T/zeit-fun-6d31861b417ef/langchain/vectorstores/chroma.py", line 78, in __init__
    self._client = chromadb.Client(self._client_settings)
  File "/Users/homanp/Projects/VERCEL_LANGCHAIN_ENV/lib/python3.9/site-packages/chromadb/__init__.py", line 68, in Client
    return chromadb.api.local.LocalAPI(settings, get_db(settings))
  File "/Users/homanp/Projects/VERCEL_LANGCHAIN_ENV/lib/python3.9/site-packages/chromadb/__init__.py", line 41, in get_db
    import chromadb.db.duckdb
  File "/Users/homanp/Projects/VERCEL_LANGCHAIN_ENV/lib/python3.9/site-packages/chromadb/db/duckdb.py", line 3, in <module>
    from chromadb.db.index.hnswlib import Hnswlib
  File "/Users/homanp/Projects/VERCEL_LANGCHAIN_ENV/lib/python3.9/site-packages/chromadb/db/index/hnswlib.py", line 8, in <module>
    import hnswlib

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 16 (4 by maintainers)

Most upvoted comments

updated: it did not work even after i degrade my python version into 3.9

@shark8me I have an M2 macbook pro and I went ahead and switched my local python version to 3.10.10 and then ran pip install chromadb with no issues.

Can you version that that pip is correct, and that you don’t need to use pip3 or other? Python environment management is tough!