python-dependency-injector icon indicating copy to clipboard operation
python-dependency-injector copied to clipboard

PydanticImportError: BaseSettings has been moved

Open laxa1986 opened this issue 6 days ago • 3 comments

Hello dear all. In my project I use fastapi and dependency-injector Today I upgradeded dedpendncy-injector 4.48.2 -> 4.48.3 after that I started to get an error in output (the app still works though) OS: MacOS 15.6.1, Apple Silicon, tried on Python 3.13 and 3.14

Minimalistic app to reproduce the error:

from fastapi import FastAPI

if __name__ == '__main__':
    from dependency_injector import containers

Error itself:

Exception ignored in PyObject_HasAttr(); consider using PyObject_HasAttrWithError(), PyObject_GetOptionalAttr() or PyObject_GetAttr():
Traceback (most recent call last):
  File "/Users/alexc/agilecustoms/github/env-api/.venv/lib/python3.14/site-packages/pydantic/__init__.py", line 437, in __getattr__
    return _getattr_migration(attr_name)
  File "/Users/alexc/agilecustoms/github/env-api/.venv/lib/python3.14/site-packages/pydantic/_migration.py", line 304, in wrapper
    raise PydanticImportError(
pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.12/migration/#basesettings-has-moved-to-pydantic-settings for more details.

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

laxa1986 avatar Dec 06 '25 04:12 laxa1986