dhasty1 / CorpPulse

0 stars 0 forks source link

Can't reproduce locally #2

Open wesslen opened 2 months ago

wesslen commented 2 months ago

Tried to run locally and got this image

Steps done:

$ git clone https://github.com/dhasty1/CorpPulse.git
$ python3.11 -m venv venv
$ source venv/bin/activate
$ python -m pip install -r requirements.txt
$ streamlit run app.py

Running on M1 Mac.

Found in logs:

Traceback (most recent call last):
  File "/Users/ryan/.pyenv/versions/3.10.11/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script
    exec(code, module.__dict__)
  File "/final-projects/CorpPulse/app.py", line 18, in <module>
    from pipeline import rag_pipeline
  File "/final-projects/CorpPulse/pipeline.py", line 1, in <module>
    from haystack.document_stores.in_memory import InMemoryDocumentStore
ModuleNotFoundError: No module named 'haystack'

Looks like your requirements.txt isn't correct.

Corrected. That wasn't the problem. See below new problem.

wesslen commented 2 months ago

So back to local install -- good news is I found I wasn't pointing to correct venv (notice it was using python3.10 yet I set up my venv with python3.11.

I saw you do have haystack-ai in requirements.txt, so it's not the requirements.txt. I corrected my right venv (python3.11) but now I get this error.

Traceback (most recent call last):
  File "/final-projects/CorpPulse/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
    exec(code, module.__dict__)
  File "/final-projects/CorpPulse/app.py", line 18, in <module>
    from pipeline import rag_pipeline
  File "/final-projects/CorpPulse/pipeline.py", line 1, in <module>
    from haystack.document_stores.in_memory import InMemoryDocumentStore
  File "/final-projects/CorpPulse/venv/lib/python3.11/site-packages/haystack/document_stores/in_memory/__init__.py", line 1, in <module>
    from haystack.document_stores.in_memory.document_store import InMemoryDocumentStore
  File "/final-projects/CorpPulse/venv/lib/python3.11/site-packages/haystack/document_stores/in_memory/document_store.py", line 8, in <module>
    from haystack import default_from_dict, default_to_dict, logging
ImportError: cannot import name 'default_from_dict' from 'haystack' (/final-projects/CorpPulse/venv/lib/python3.11/site-packages/haystack/__init__.py)

So problem is ImportError: cannot import name 'default_from_dict' from 'haystack' (/final-projects/CorpPulse/venv/lib/python3.11/site-packages/haystack/__init__.py).

I'm wondering if perhaps you didn't pin the right version of haystack-ai.

wesslen commented 2 months ago

Found this: https://github.com/deepset-ai/haystack/issues/6470#issuecomment-1900723211

I think at some point haystack-ai changed its import. My recommendation would be to pin haystack-ai to an earlier version. I suspect you took an online tutorial that called haystack using the older import way but your requirements.txt is installing the latest version.