Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import vaex error: PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package

I am using Sagemaker notebook and when importing vaex, I am getting the below error. the version of vaex I'm using is 4.16.0

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

Anyone knows how to solve this?

I tried downgrading the pydantic library while installing vaex but that didn't help.

like image 319
Kailash M S Avatar asked Sep 05 '25 03:09

Kailash M S


2 Answers

What i have done Migration Guide

pip install pydantic-settings

I replaced in my code:

# from pydantic import BaseSettings # OLD
from pydantic_settings import BaseSettings # NEW
like image 127
M Btki Avatar answered Sep 07 '25 16:09

M Btki


In pydantic-V2, Settings management has been moved to a separate package named pydantic-settings.

You can install it by pip install pydantic-settings.

If you still want to have V1-style settings management in V2, you can import it like:

from pydantic.v1 import BaseSettings
like image 42
Hasan Ramezani Avatar answered Sep 07 '25 17:09

Hasan Ramezani