mem0ai / mem0

The Memory layer for your AI apps
https://mem0.ai
Apache License 2.0
21.73k stars 1.98k forks source link

PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` #1374

Closed rajjyotiroy closed 6 days ago

rajjyotiroy commented 3 months ago

🐛 Describe the bug

I am getting this error:

PydanticImportError                       Traceback (most recent call last)
Cell In[5], line 6
      3 # Replace this with your HF token
      4 os.environ["HUGGINGFACE_ACCESS_TOKEN"] = ""
----> 6 from embedchain import App
      8 config = {
      9   'llm': {
     10     'provider': 'huggingface',
   (...)
     21   }
     22 }
     23 app = App.from_config(config=config)

File ~/python3.12/site-packages/embedchain/__init__.py:1
----> 1 from .embedchain import App

File ~/python3.12/site-packages/embedchain/embedchain.py:1
----> 1 import chromadb
      2 import openai
      3 import os

File ~/python3.12/site-packages/chromadb/__init__.py:2
      1 from typing import Any, Dict
----> 2 import chromadb.config
      3 import logging
      4 from chromadb.telemetry.events import ClientStartEvent

File ~/python3.12/site-packages/chromadb/config.py:1
----> 1 from pydantic import BaseSettings
      2 from typing import List
      4 TELEMETRY_WHITELISTED_SETTINGS = [
      5     "chroma_db_impl",
      6     "chroma_api_impl",
      7     "chroma_server_ssl_enabled",
      8 ]

File ~/python3.12/site-packages/pydantic/__init__.py:386, in __getattr__(attr_name)
    384 dynamic_attr = _dynamic_imports.get(attr_name)
    385 if dynamic_attr is None:
--> 386     return _getattr_migration(attr_name)
    388 package, module_name = dynamic_attr
    390 from importlib import import_module

File ~/python3.12/site-packages/pydantic/_migration.py:296, in getattr_migration.<locals>.wrapper(name)
    294     return import_string(REDIRECT_TO_V1[import_path])
    295 if import_path == 'pydantic:BaseSettings':
--> 296     raise PydanticImportError(
    297         '`BaseSettings` has been moved to the `pydantic-settings` package. '
    298         f'See https://docs.pydantic.dev/{version_short()}/migration/#basesettings-has-moved-to-pydantic-settings '
    299         'for more details.'
    300     )
    301 if import_path in REMOVED_IN_V2:
    302     raise PydanticImportError(f'`{import_path}` has been removed in V2.')

PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.7/migration/#basesettings-has-moved-to-pydantic-settings for more details.

I am getting this error as we have to change import of BaseSettings from pydantic to pydantic_settings

roshanr11 commented 3 months ago

Can work on this issue!

Dev-Khant commented 2 months ago

@roshanr11 Please update your embedchain to the latest version, this should fix the issue. Let me know if this helps.

Prabhat-Thapa45 commented 1 month ago

is this issue solved? @Dev-Khant

Dev-Khant commented 1 month ago

Yes it's working properly for latest version of embedchain.

shivani-developer commented 1 week ago

Can this issue be closed?

Dev-Khant commented 6 days ago

Closing this issue as it has been fixed.