Kailash M S
Kailash M S

Reputation: 281

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.

Upvotes: 28

Views: 53449

Answers (4)

user23394987
user23394987

Reputation: 21

!pip install https://github.com/pandas-profiling/pandas-profiling/archive/master.zip

import seaborn as sns df = sns.load_dataset('tips') df.head()

from pydantic_settings import BaseSettings from pandas_profiling import ProfileReport # Assuming you have already imported df and it contains your DataFrame

profile = ProfileReport(df, explorative=True, dark_mode=True) profile.to_file('output.html')

Upvotes: 2

Anton Alyabyev
Anton Alyabyev

Reputation: 11

You can find answer in the error log.

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

Read migration guide.

pip install bump-pydantic
cd ~/anaconda3/lib/python3.11/site-packages
bump-pydantic anaconda_cloud_auth
bump-pydantic anaconda_navigator

Upvotes: 1

Hasan Ramezani
Hasan Ramezani

Reputation: 5194

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

Upvotes: 9

M Btki
M Btki

Reputation: 431

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

Upvotes: 42

Related Questions