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

Pydantic >2.0.* seems to result in problems #196

Closed
maralasar opened this issue Jul 6, 2023 · 2 comments
Closed

Pydantic >2.0.* seems to result in problems #196

maralasar opened this issue Jul 6, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@maralasar
Copy link

maralasar commented Jul 6, 2023

Describe the bug
When running my code (can't post it here), I get an import error from filip as a site package installed in an venv!

  File "...", line 4, in <module>
    from filip.models.ngsi_v2.iot import ServiceGroup
  File ".../venv/lib/python3.7/site-packages/filip/__init__.py", line 4, in <module>
    from filip.config import settings
  File ".../venv/lib/python3.7/site-packages/filip/config.py", line 7, in <module>
    from pydantic import BaseSettings, Field, AnyHttpUrl
  File ".../venv/lib/python3.7/site-packages/pydantic/__init__.py", line 206, in __getattr__
    return _getattr_migration(attr_name)
  File ".../venv/lib/python3.7/site-packages/pydantic/_migration.py", line 280, in wrapper
    '`BaseSettings` has been moved to the `pydantic-settings` package. '
pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.0.2/migration/#basesettings-has-moved-to-pydantic-settings for more details.
For further information visit https://errors.pydantic.dev/2.0.2/u/import-error

I had to adjust some of the pathes in the error message, due to restricted information!

To Reproduce
Steps to reproduce the behavior:

  1. pip install filip
  2. run any code that imports BaseSettings from Pydantic (in my case it was ServiceGroup )

Environment (please complete the following information):

  • OS: Windows 10
  • Python-Version: 3.10, 3.9, 3.8, 3.7
  • FiLiP-Version: 0.2.5

Additional context
In requirements.txt and setup.pythe version of pydantic is just defined using >= which is likely the cause. In pydantic v2.* there seems to be a change in the structure resulting in the ImportError above!
Maybe fixing it to pydantic~=1.10.11 (lastest v1 version) would solve the problem until v2 is more common!
At the moment in theory everyone installing filip into a new environment will end up with this error!

@maralasar maralasar added the bug Something isn't working label Jul 6, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Branch 196-Pydantic-2-0-seems-to-result-in-problems created!

@tstorek
Copy link
Collaborator

tstorek commented Jan 15, 2024

fixed by #199

@tstorek tstorek closed this as completed Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants