langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Dependency issue with VectorstoreIndexCreator().from_loaders

Open giobirkelund opened this issue 2 years ago • 1 comments

When running the following code, I get the message that I need to install the chromadb package. I try to install chromadb, and get the following error with hnswlib.

I've tried creating a brand new venv with just openai, and langchain. Still get this issue. Any idea why this could be, and how to fix it?

I'm using Python 3.11.3 My code:

import os
from langchain.document_loaders import WebBaseLoader
from langchain.indexes import VectorstoreIndexCreator

os.environ["OPENAI_API_KEY"] = ***

loader = WebBaseLoader("https://www.espn.com/soccer")
index = VectorstoreIndexCreator().from_loaders([loader])

The error:

Building wheels for collected packages: hnswlib
  Building wheel for hnswlib (pyproject.toml) ... error
  error: subprocess-exited-with-error
 ... 
      clang: error: the clang compiler does not support '-march=native'
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hnswlib
Failed to build hnswlib
ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects

I've tried:

pip install --upgrade pip
pip install --no-cache-dir --no-binary :all: hnswlib
pip install hnswlib chromadb

Thanks!

giobirkelund avatar Apr 22 '23 04:04 giobirkelund

What environment are you installing it in? I have got the similar issue in docker python:3.10-slim-buster base image and adding apt-get install --no-install-recommends -y build-essential gcc fixed it, however locally with poetry I didn't have the issue.

ehsanmok avatar Apr 22 '23 05:04 ehsanmok

The issue was due to using python 3.11, downgrading to 3.9 resolved this.

giobirkelund avatar Apr 28 '23 02:04 giobirkelund

The issue was due to using Python 3.11, downgrading to 3.9 resolved this.

I am using Python 3.9 and facing the same issue; any suggestions, please?

sunaarun avatar Jan 08 '24 19:01 sunaarun