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

[BUG-REPORT] PydanticImportError: BaseSettings has been moved #2384

Closed
mfouesneau opened this issue Jul 11, 2023 · 16 comments · Fixed by #2331
Closed

[BUG-REPORT] PydanticImportError: BaseSettings has been moved #2384

mfouesneau opened this issue Jul 11, 2023 · 16 comments · Fixed by #2331

Comments

@mfouesneau
Copy link
Contributor

mfouesneau commented Jul 11, 2023

I am getting a strange error on a fresh installation of Vaex with pip install

Description
I get PydanticImportError; see full log below

Software information

  • Vaex version (import vaex; vaex.__version__): 4.16.0
  • pydantic: 2.0.2 (I suppose installed as dependency with vaex)
  • Vaex was installed via: pip
  • OS: linux
  • python 3.10.8

Additional information

In [1]: import vaex
---------------------------------------------------------------------------
PydanticImportError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 import vaex

File /usr/local/python/3.10.8/lib/python3.10/site-packages/vaex/__init__.py:41
     38 from urllib.parse import urlparse, parse_qs
     40 # first configure logging, which also imports vaex.settings
---> 41 import vaex.logging
     42 # import this to be explicit
     43 import vaex.settings

File /usr/local/python/3.10.8/lib/python3.10/site-packages/vaex/logging.py:7
      1 """Sets up logging for vaex.
      2 
      3 See `configuration of logging <conf.html#logging>`_ how to configure logging.
      4 
      5 """
      6 import os
----> 7 import vaex.settings
      8 import logging
     10 logger = logging.getLogger('vaex')

File /usr/local/python/3.10.8/lib/python3.10/site-packages/vaex/settings.py:10
      7 import multiprocessing
      8 import sys
---> 10 from pydantic import BaseModel, BaseSettings, Field
     11 from typing import List, Union, Optional, Dict
     12 from enum import Enum

File /usr/local/python/3.10.8/lib/python3.10/site-packages/pydantic/__init__.py:206, in __getattr__(attr_name)
    204 dynamic_attr = _dynamic_imports.get(attr_name)
    205 if dynamic_attr is None:
--> 206     return _getattr_migration(attr_name)
    208 from importlib import import_module
    210 module = import_module(_dynamic_imports[attr_name], package=__package__)

File /usr/local/python/3.10.8/lib/python3.10/site-packages/pydantic/_migration.py:279, in getattr_migration.<locals>.wrapper(name)
    277     return import_string(DEPRECATED_MOVED_IN_V2[import_path])
    278 if import_path == 'pydantic:BaseSettings':
--> 279     raise PydanticImportError(
    280         '`BaseSettings` has been moved to the `pydantic-settings` package. '
    281         f'See https://docs.pydantic.dev/{VERSION}/migration/#basesettings-has-moved-to-pydantic-settings '
    282         'for more details.'
    283     )
    284 if import_path in REMOVED_IN_V2:
    285     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.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
@pwikstrom
Copy link

pwikstrom commented Jul 11, 2023

Try downgrading pydantic to 1.10.8 - it worked for me.

@maartenbreddels
Copy link
Member

vaex-core is released, but i cannot release it on conda-forge https://github.com/conda-forge/vaex-core-feedstock/pull/93/checks?check_run_id=14928738193 because of a weird issue. I also need to release vaex (the metapackage) before you get the new vaex-core.
Til that time downgrading pedantic is the best solution

@ddelange
Copy link
Contributor

ddelange commented Oct 28, 2023

does it make sense to pin pydantic<2 in vaex-core setup.py?

alternatively a fallback import from pydantic.v1 would be possible ref awslabs/gluonts#3026

@maxcohen55
Copy link

Any updates on this? Same thing is happening with a fresh install using conda.

@maartenbreddels
Copy link
Member

Could you be more specific? vaex-core 4.17.1 is released, also on conda-forge, so this should work. What versions are you getting?

@ddelange
Copy link
Contributor

ddelange commented Mar 5, 2024

does it make sense to pin pydantic<2 in vaex-core setup.py?

alternatively a fallback import from pydantic.v1 would be possible ref awslabs/gluonts#3026

currently, pydantic 2.0 is allowed ref https://github.com/vaexio/vaex/blob/core-v4.17.1/packages/vaex-core/setup.py#L33

but there is no support for pydantic 2.0 in the codebase yet

@maartenbreddels
Copy link
Member

pydantic is not used anymore in vaex-core after #2339 (which is released in vaex-core 4.17.0)

@ddelange
Copy link
Contributor

ddelange commented Mar 5, 2024

aha, missed that. so probably this issue is fixed by #2339 :)

@maxcohen55
Copy link

maxcohen55 commented Mar 8, 2024

Could you be more specific? vaex-core 4.17.1 is released, also on conda-forge, so this should work. What versions are you getting?

also 4.17.1. Let me know what other info I can provide.

@marxide
Copy link

marxide commented Apr 11, 2024

Also encountered this error with a fresh install of vaex from conda-forge.

Installing a subset of vaex-* packages instead of the meta-package also produced this issue. The culprit in my case ended up being vaex-server.

@Ge0rges
Copy link

Ge0rges commented Jun 12, 2024

@maartenbreddels it seems like 4.17 isn't available on conda-forge, so the default install people are getting (including myself) is 4.16 which has the wrong version of pydantic associated with it.
mamba install -c conda-forge vaex==4.17.0 on linux-64 gets a package does not exist error as well as 4.17 and 4.17.1

@showkeyjar
Copy link

+1

@Eisbrenner
Copy link

Just to report in (I'll downgrade pydantic next): got the issue on 4.17.1

$ mamba list vaex
# packages in environment at /home/eris/miniforge3/envs/016_vaex:
#
# Name                    Version                   Build  Channel
vaex-astro                0.9.3              pyhd8ed1ab_0    conda-forge
vaex-core                 4.17.1          py310h474ec31_0    conda-forge
vaex-hdf5                 0.14.1             pyhd8ed1ab_0    conda-forge
vaex-jupyter              0.8.1              pyhd8ed1ab_0    conda-forge
vaex-ml                   0.18.1             pyhd8ed1ab_0    conda-forge
vaex-server               0.8.1              pyhd8ed1ab_0    conda-forge
vaex-viz                  0.5.4              pyhd8ed1ab_0    conda-forge
PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.8/migration/#basesettings-has-moved-to-pydantic-settings for more details.

@ddelange
Copy link
Contributor

ddelange commented Sep 9, 2024

fwiw pytest is passing with pydantic 2.8 in #2331

cswartzvi added a commit to cswartzvi/hamilton that referenced this issue Sep 13, 2024
cswartzvi added a commit to cswartzvi/hamilton that referenced this issue Sep 14, 2024
elijahbenizzy pushed a commit to DAGWorks-Inc/hamilton that referenced this issue Sep 17, 2024
* Add pydantic validation

* Add pydantic plugin

* Add tests for pydantic validation and plugin

* Add pydantic to dependencies

* Resolve issues from code review

* Make type hints backward compatible

* Remove `pydantic` constraint for `vaex`

Note that vaexio/vaex#2384 has been resolved

* Improve pydantic validator test import

* Add docstring to the pydantic check_output

* Add initial pydantic data quality docs

* Fix `pydantic support` title underline

* Fix pydantic strict mode link

* Fix spacing after `code-block`

* Add pydantic plugin details

* Fix double quotes for code references

* Remove name tags

* Add additional docstring example; tweak wording
@hermidalc
Copy link

hermidalc commented Oct 30, 2024

As of today vaex 4.17 still isn't available on conda-forge

@ddelange
Copy link
Contributor

@hermidalc ref #2331 (comment)

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

Successfully merging a pull request may close this issue.

10 participants