Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Issue related to Pydantic V1/V2 #12

Open
danphenderson opened this issue Dec 7, 2023 · 1 comment
Open

Import Issue related to Pydantic V1/V2 #12

danphenderson opened this issue Dec 7, 2023 · 1 comment

Comments

@danphenderson
Copy link

After installing 'async-openai' into my projects environment with pipenv, I am receiving this issue:

In [1]: from async_openai import OpenAI, settings, CompletionResponse
    ....
    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.5/migration/#basesettings-has-moved-to-pydantic-settings for more details.

In the setup.py requirements, I see this note on line 21:

# 'pydantic-settings', # remove to allow for v1/v2 support

Assuming `remove ' means uncomment, simply reinstalling as such won't fix my issue; pydantic-settings is already in my environment:

$ pip freeze | grep pydantic
pydantic==2.5.2
pydantic-settings==2.1.0
pydantic_core==2.14.5

@Primordial1
Copy link

Was the change to setup.py enough to fix the issue in your environment? I'm seeing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants