Summary
After this has been working before, all of a sudden, I receive an import error:
File "/home/adminuser/venv/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 47, in dependable_faiss_import
import faiss
ModuleNotFoundError: No module named 'faiss'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.__dict__)
File "/mount/src/work_apps/apps_comb.py", line 1489, in <module>
page_names_to_funcs[demo_name]()
File "/mount/src/work_apps/apps_comb.py", line 1430, in contract_analysis
main()
File "/mount/src/work_apps/apps_comb.py", line 1378, in main
docsearch = FAISS.from_texts(chunks, embeddings)
File "/home/adminuser/venv/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 603, in from_texts
return cls.__from(
File "/home/adminuser/venv/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 557, in __from
faiss = dependable_faiss_import()
File "/home/adminuser/venv/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 49, in dependable_faiss_import
raise ImportError(
ImportError: Could not import faiss python package. Please install it with `pip install faiss-gpu` (for CUDA supported GPU) or `pip install faiss-cpu` (depending on Python version).
**Expected behavior:**
it worked before -
Import:
import streamlit as st
import os
import sys
import re
import time
import openai
import subprocess
import platform
import pdfplumber
from docx import Document
from langchain.vectorstores import FAISS
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.chat_models import ChatOpenAI
from langchain.chains.question_answering import load_qa_chain
from langchain.llms import OpenAI
from langchain.chains import RetrievalQA
import pandas as pd
import time
from bs4 import BeautifulSoup
import requests
from urllib.parse import urlparse, urljoin
import tempfile
#import extract_msg
from email.header import decode_header
- Streamlit version: (get it with `$ streamlit version`)
Found Streamlit version 1.25.0 in the environment
- Python version: (get it with `$ python --version`) -
3.10
- Using Conda? PipEnv? PyEnv? Pex?
No
- OS version:
MacOS 13.4.1
- Browser version:
Safari, Chrome
### Requirements file
beautifulsoup4==4.11.2
docx==0.2.4
langchain==0.0.273
openai==0.27.6
pandas==2.0.2
pdfplumber==0.9.0
python_docx==0.8.11
Requests==2.31.0
streamlit==1.25.0
tiktoken
faiss-cpu
### Links
* Link to your GitHub repo:
* Link to your deployed app: https://workapps-rixy8gkhsbzbfxfpweylgh.streamlit.app/
### Additional information
worked fine until yesterday (problems only arise when handling big docs that require chunking, embedding and faiss q&a chain)
works fine on local machine
If needed, add any other context about the problem here.