haystack icon indicating copy to clipboard operation
haystack copied to clipboard

problem with importing haystack

Open tareeesh2001 opened this issue 3 years ago • 4 comments

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?

tareeesh2001 avatar Oct 09 '23 15:10 tareeesh2001

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

ZanSara avatar Oct 09 '23 16:10 ZanSara

Possibly related to this other open issue: https://github.com/deepset-ai/haystack/issues/5473

julian-risch avatar Oct 09 '23 16:10 julian-risch

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)

ZanSara avatar Oct 09 '23 16:10 ZanSara

Please follow instructions here https://github.com/deepset-ai/haystack/issues/5473#issuecomment-1732470455

masci avatar Dec 11 '23 08:12 masci