Skip to content

Error importing module #2170

@rizasaputra

Description

@rizasaputra

[ v ] I have checked the documentation and related resources and couldn't resolve my bug.

Describe the bug
Error module 'pyarrow' has no attribute 'PyExtensionType' directly appeared after installing and importing ragas

Ragas version: 0.3.1
Python version: 3.11

Code to Reproduce
In notebook:

!pip install ragas
from ragas import evaluate

Error trace

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], line 12
      1 # from ragas.metrics import (
      2 #     ContextRelevance,
      3 #     ResponseGroundedness, 
   (...)
     10 #     EvaluationDataset
     11 # )
---> 12 from ragas import evaluate
     13 # from ragas.llms import LangchainLLMWrapper
     14 # import ragas

File [/opt/conda/lib/python3.11/site-packages/ragas/__init__.py:2](https://lt7bqomdzjry51g.studio.us-west-2.sagemaker.aws/opt/conda/lib/python3.11/site-packages/ragas/__init__.py#line=1)
      1 from ragas.cache import CacheInterface, DiskCacheBackend, cacher
----> 2 from ragas.dataset_schema import EvaluationDataset, MultiTurnSample, SingleTurnSample
      3 from ragas.evaluation import evaluate
      4 from ragas.run_config import RunConfig

File [/opt/conda/lib/python3.11/site-packages/ragas/dataset_schema.py:13](https://lt7bqomdzjry51g.studio.us-west-2.sagemaker.aws/opt/conda/lib/python3.11/site-packages/ragas/dataset_schema.py#line=12)
     11 import numpy as np
     12 import requests
---> 13 from datasets import Dataset as HFDataset
     14 from pydantic import BaseModel, field_validator
     16 from ragas._version import __version__

File [/opt/conda/lib/python3.11/site-packages/datasets/__init__.py:37](https://lt7bqomdzjry51g.studio.us-west-2.sagemaker.aws/opt/conda/lib/python3.11/site-packages/datasets/__init__.py#line=36)
     34 del pyarrow
     35 del version
---> 37 from .arrow_dataset import Dataset, concatenate_datasets
     38 from .arrow_reader import ReadInstruction
     39 from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder

File [/opt/conda/lib/python3.11/site-packages/datasets/arrow_dataset.py:61](https://lt7bqomdzjry51g.studio.us-west-2.sagemaker.aws/opt/conda/lib/python3.11/site-packages/datasets/arrow_dataset.py#line=60)
     59 from . import config
     60 from .arrow_reader import ArrowReader
---> 61 from .arrow_writer import ArrowWriter, OptimizedTypedSequence
     62 from .features import Audio, ClassLabel, Features, Image, Sequence, Value
     63 from .features.features import FeatureType, _ArrayXD, decode_nested_example, pandas_types_mapper, require_decoding

File [/opt/conda/lib/python3.11/site-packages/datasets/arrow_writer.py:26](https://lt7bqomdzjry51g.studio.us-west-2.sagemaker.aws/opt/conda/lib/python3.11/site-packages/datasets/arrow_writer.py#line=25)
     23 import pyarrow as pa
     25 from . import config
---> 26 from .features import Features, Image, Value
     27 from .features.features import (
     28     FeatureType,
     29     _ArrayXDExtensionType,
   (...)
     34     numpy_to_pyarrow_listarray,
     35 )
     36 from .info import DatasetInfo

File [/opt/conda/lib/python3.11/site-packages/datasets/features/__init__.py:18](https://lt7bqomdzjry51g.studio.us-west-2.sagemaker.aws/opt/conda/lib/python3.11/site-packages/datasets/features/__init__.py#line=17)
      3 __all__ = [
      4     "Audio",
      5     "Array2D",
   (...)
     15     "TranslationVariableLanguages",
     16 ]
     17 from .audio import Audio
---> 18 from .features import Array2D, Array3D, Array4D, Array5D, ClassLabel, Features, Sequence, Value
     19 from .image import Image
     20 from .translation import Translation, TranslationVariableLanguages

File [/opt/conda/lib/python3.11/site-packages/datasets/features/features.py:513](https://lt7bqomdzjry51g.studio.us-west-2.sagemaker.aws/opt/conda/lib/python3.11/site-packages/datasets/features/features.py#line=512)
    509     # Automatically constructed
    510     _type: str = field(default="Array5D", init=False, repr=False)
--> 513 class _ArrayXDExtensionType(pa.PyExtensionType):
    514     ndims: Optional[int] = None
    516     def __init__(self, shape: tuple, dtype: str):

AttributeError: module 'pyarrow' has no attribute 'PyExtensionType'

Expected behavior
Module imported successfully

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions