AIAnytime / Chat-with-PDF-Chatbot

This Chatbot is an interactive app developed to assist users to interact with their PDF. It is built using Open Source Stack. No OpenAI is required.
MIT License
144 stars 110 forks source link

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

Open andysingal opened 1 year ago

andysingal commented 1 year ago
import os 
import chromadb
from chromadb.config import Settings 
CHROMA_SETTINGS = Settings(
        chroma_db_impl='duckdb+parquet',
        persist_directory='db',
        anonymized_telemetry=False
)

gives error:

---------------------------------------------------------------------------
PydanticImportError                       Traceback (most recent call last)
[<ipython-input-24-ba6cc87c8bff>](https://localhost:8080/#) in <cell line: 2>()
      1 import os
----> 2 import chromadb
      3 from chromadb.config import Settings
      4 CHROMA_SETTINGS = Settings(
      5         chroma_db_impl='duckdb+parquet',

3 frames
[/usr/local/lib/python3.10/dist-packages/pydantic/_migration.py](https://localhost:8080/#) in wrapper(name)
    287             return import_string(REDIRECT_TO_V1[import_path])
    288         if import_path == 'pydantic:BaseSettings':
--> 289             raise PydanticImportError(
    290                 '`BaseSettings` has been moved to the `pydantic-settings` package. '
    291                 f'See [https://docs.pydantic.dev/{version_short()}/migration/#basesettings-has-moved-to-pydantic-settings](https://docs.pydantic.dev/%7Bversion_short()%7D/migration/#basesettings-has-moved-to-pydantic-settings) '

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

For further information visit https://errors.pydantic.dev/2.2/u/import-error

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
manjunathshiva commented 1 year ago

Just downgrade Pydantic V2 to Pydantic V1

pip install "pydantic==1.*"

After that got pypdf Module not found error! So pip install pypdf fixed the issue

Anas-jaffery-kodexolab commented 2 months ago

Just downgrade Pydantic V2 to Pydantic V1

pip install "pydantic==1.*"

After that got pypdf Module not found error! So pip install pypdf fixed the issue

I have tried this but I am getting other conflicts error ERROR: Could not find a version that satisfies the requirement pydantic-settings==1.0.2 (from versions: 0.1.0a1, 0.1.0a2, 0.1.1b0, 0.1.2b0, 0.2.5, 1.99, 2.0a1, 2.0a3, 2.0a4, 2.0b1, 2.0b2, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0, 2.2.0, 2.2.1, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4) ERROR: No matching distribution found for pydantic-settings==1.0.2

when I tried to resolve dependencies error by following command

pip install pydantic==1.9.0 fastapi==0.85.1 chromadb==0.3.26 openapi-schema-pydantic==1.2.4 pydantic-settings==0.2.5 I got another error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [54 lines of output] running egg_info writing lib3\PyYAML.egg-info\PKG-INFO writing dependency_links to lib3\PyYAML.egg-info\dependency_links.txt writing top-level names to lib3\PyYAML.egg-info\top_level.txt