problem with importing haystack
I am using python==3.10.9 and python==3.11.4 I am getting an error while importing Documents from haystack. this is the error that I have faced:
Traceback (most recent call last): File "/Users/sairohith/Downloads/Haystack-and-Mistral-7B-RAG-Implementation/ingest.py", line 1, in from haystack.nodes import EmbeddingRetriever, MarkdownConverter, PreProcessor, AnswerParser, PromptModel, PromptNode, PromptTemplate File "/Users/sairohith/anaconda3/envs/tg/lib/python3.10/site-packages/haystack/nodes/init.py", line 3, in from haystack.nodes.answer_generator import BaseGenerator, OpenAIAnswerGenerator File "/Users/sairohith/anaconda3/envs/tg/lib/python3.10/site-packages/haystack/nodes/answer_generator/init.py", line 2, in from haystack.nodes.answer_generator.openai import OpenAIAnswerGenerator File "/Users/sairohith/anaconda3/envs/tg/lib/python3.10/site-packages/haystack/nodes/answer_generator/openai.py", line 6, in from haystack import Document ImportError: cannot import name 'Document' from 'haystack' (/Users/sairohith/anaconda3/envs/tg/lib/python3.10/site-packages/haystack/init.py)
Can anyone give a solution to this?
Hay @tareeesh2001 how did you install Haystack? Can you tell us the version of Haystack you are using and the OS you are on?
By the way, we normally help people with these sort of issues on Discord, so next time join us there! https://discord.gg/yhkuA9nw
Possibly related to this other open issue: https://github.com/deepset-ai/haystack/issues/5473
That's right @julian-risch, it's probably related. To my knowledge this issue occurs when users do conda install farm-haystack. When one does pip install farm-haystack, it works. It can be easily spotted by either the way they install it (with conda) or by the version they end up installing (something like 0.0.1.post3)
Please follow instructions here https://github.com/deepset-ai/haystack/issues/5473#issuecomment-1732470455