I was trying to install 'farm-haystack' and 'farm' (farm-haystack==1.21.2 farm==0.2.0) on ubuntu 22.04. after installation trying to call elastic search by the below command : "from haystack.document_stores import ElasticsearchDocumentStore"
but its gives me below error:
Output exceeds the size limit. Open the full output data in a text editor
PydanticSchemaGenerationError Traceback (most recent call last) Cell In[10], line 1 ----> 1 from haystack.document_stores import ElasticsearchDocumentStore
File /usr/local/lib/python3.10/dist-packages/haystack/init.py:10 6 version: str = str(metadata.version("farm-haystack")) 9 import haystack.silenceable_tqdm # Needs to be imported first to wrap TQDM for all following modules ---> 10 from haystack.schema import Document, Answer, Label, MultiLabel, Span, EvaluationResult, TableCell 11 from haystack.nodes.base import BaseComponent 12 from haystack.pipelines.base import Pipeline
File /usr/local/lib/python3.10/dist-packages/haystack/schema.py:43 38 ContentTypes = Literal["text", "table", "image", "audio"] 39 FilterType = Dict[str, Union[Dict[str, Any], List[Any], str, int, float, bool]] 42 @dataclass ---> 43 class Document: 44 id: str 45 content: Union[str, DataFrame]
File ~/.local/lib/python3.10/site-packages/pydantic/dataclasses.py:213, in dataclass(_cls, init, repr, eq, order, unsafe_hash, frozen, config, validate_on_init, kw_only, slots)
210 if _cls is None:
211 return create_dataclass
--> 213 return create_dataclass(_cls)
...
PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'pandas.core.frame.DataFrame'>. Set arbitrary_types_allowed=True
in the model_config to ignore this error or implement __get_pydantic_core_schema__
on your type to fully support it.
If you got this error by calling handler() within __get_pydantic_core_schema__
then you likely need to call handler.generate_schema(<some type>)
since we do not call __get_pydantic_core_schema__
on <some type>
otherwise to avoid infinite recursion.
For further information visit https://errors.pydantic.dev/2.4/u/schema-for-unknown-type
Please help me resolve this matter Thanks
I don't know if you have figured it out already or not. However, I ran into similar problem. I didn't touch anything on my previous conda environment. All of a sudden, I was getting the same error.
What solved for me is -
pip install farm-haystack[all]
That's pretty much it. Wish you all the best!