explodinggradients / ragas

Supercharge Your LLM Application Evaluations 🚀
https://docs.ragas.io
Apache License 2.0
7.07k stars 718 forks source link

metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases #1457

Open vohoangkh4ng opened 3 weeks ago

vohoangkh4ng commented 3 weeks ago

[ ] I checked the documentation and related resources and couldn't find an answer to my question.

Your Question when i import library from ragas i get metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Code Examples from ragas.metrics import faithfullness from ragas import evaluate

Additional context What version of ragas i can use ?

dosubot[bot] commented 3 weeks ago

Hey @vohoangkh4ng! I'm here to help you out with any bugs or questions you have. Let's tackle this issue together!

The error you're encountering is related to a metaclass conflict, which can occur when a class inherits from multiple base classes with different metaclasses. Unfortunately, I don't have specific information on metaclass conflicts or version requirements for the Ragas library.

To resolve this, you can try the following steps:

  1. Check for Updates: Ensure you are using the latest version of Ragas. Sometimes, such conflicts are resolved in newer releases.

  2. Review Dependencies: Check if there are any specific dependencies or Python version requirements that might affect metaclass behavior.

  3. Simplify Imports: Try importing only the necessary components to isolate the issue.

If these steps don't help, consider checking the Ragas repository for any recent commits or issues related to metaclass conflicts.

To continue talking to Dosu, mention @dosu.

VMinB12 commented 1 week ago

I encountered this issue too after migration to langchain-core==0.3.x and switching from Pydantic v1 to v2. It would be great if Ragas could be updated to be compatible.

Mukhsin0508 commented 1 week ago

I am getting the same error but with Django viewsets

jjmachan commented 6 days ago

@VMinB12 @Mukhsin0508 are you guys using v0.2+ we do support the libs you mentioned now with that update

Mukhsin0508 commented 3 days ago

@vohoangkh4ng There's a typo in your import: you wrote faithfullness instead of faithfulness

# Solution 1: Clean installation with specific versions
# First, uninstall existing packages
pip uninstall ragas langchain datasets -y

# Install specific versions known to work together
pip install ragas==0.0.22
pip install langchain==0.0.350
pip install datasets==2.14.7

# Your imports should now work
from ragas.metrics import faithfulness  # Note the correct spelling
from ragas import evaluate

Check your Python version (Ragas works best with Python 3.8-3.10) b. Make sure you don't have conflicting packages in your environment c. Try running:


pythonCopypip freeze | grep -i "ragas\|langchain\|datasets"