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

Building krr for openSUSE Tumbleweed fails: pydantic.errors.PydanticImportError: BaseSettings has been moved to the pydantic-settings package. #244

Open
johanneskastl opened this issue Mar 25, 2024 · 3 comments

Comments

@johanneskastl
Copy link

Describe the bug
When trying to package krr for openSUSE Tumbleweed, the build fails due to changes in pydantic.

This seems to be caused by changes in pydantic that krr is not yet adapted to (at least in my not-a-python-expert-only-a-packager opinion):

[  147s] Using alternative krr-3.11 for krr in ./build/flavorbin during Python 3.11 expansions.
[  147s] + export PATH=/home/abuild/rpmbuild/BUILD/krr-1.7.1/build/flavorbin:/usr/local/bin:/usr/bin:/bin
[  147s] + PATH=/home/abuild/rpmbuild/BUILD/krr-1.7.1/build/flavorbin:/usr/local/bin:/usr/bin:/bin
[  147s] ++ '[' -f _current_flavor ']'
[  147s] ++ cat _current_flavor
[  147s] + last_flavor=python311
[  147s] + '[' -z python311 ']'
[  147s] + '[' python311 '!=' python39 ']'
[  147s] + '[' -d build ']'
[  147s] + mv build _build.python311
[  147s] + '[' -d _build.python39 ']'
[  147s] + mv _build.python39 build
[  147s] + echo python39
[  147s] + python_flavor=python39
[  147s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-krr-1.7.1-0.x86_64/usr/lib/python3.9/site-packages
[  147s] + PYTHONDONTWRITEBYTECODE=1
[  147s] + pytest-3.9 --ignore=_build.python39 --ignore=_build.python310 --ignore=_build.python311 -v
[  149s] ImportError while loading conftest '/home/abuild/rpmbuild/BUILD/krr-1.7.1/tests/conftest.py'.
[  149s] tests/conftest.py:8: in <module>
[  149s]     from robusta_krr.api.models import K8sObjectData, PodData, ResourceAllocations
[  149s] ../../BUILDROOT/python-krr-1.7.1-0.x86_64/usr/lib/python3.9/site-packages/robusta_krr/__init__.py:1: in <module>
[  149s]     from .main import run
[  149s] ../../BUILDROOT/python-krr-1.7.1-0.x86_64/usr/lib/python3.9/site-packages/robusta_krr/main.py:17: in <module>
[  149s]     from robusta_krr.core.models.config import Config
[  149s] ../../BUILDROOT/python-krr-1.7.1-0.x86_64/usr/lib/python3.9/site-packages/robusta_krr/core/models/config.py:20: in <module>
[  149s]     class Config(pd.BaseSettings):
[  149s] /usr/lib/python3.9/site-packages/pydantic/__init__.py:374: in __getattr__
[  149s]     return _getattr_migration(attr_name)
[  149s] /usr/lib/python3.9/site-packages/pydantic/_migration.py:296: in wrapper
[  149s]     raise PydanticImportError(
[  149s] E   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.
[  149s] E
[  149s] E   For further information visit https://errors.pydantic.dev/2.6/u/import-error

Kind Regards,
Johannes

@LeaveMyYard
Copy link
Contributor

Hey, @johanneskastl

Pydantic moved BaseSettings in 2.0 version, so I assume you have a newer, non-compatible version installed, as KRR uses pydantic = "1.10.7"

Could you please verify if installing a correct version of pydantic fixes your issue?

@johanneskastl
Copy link
Author

Hi @LeaveMyYard

openSUSE Tumbleweed uses the latest stable versions of many many packages. So there is no old version of pydantic available anymore.

Are there any plans to support a newer pydantic version (soon-ish)? If not, then it might make sense to provide the (apparently also supported 1.x version of pydantic for openSUSE Tumbleweed.

@LeaveMyYard
Copy link
Contributor

Currently we do not have plans for that, but it should be straightforward to update pydantic. If someone can do the PR, I will merge it.
But could you explain why and how are you doing a build on your side? Maybe a pre-built with pyinstaller release will work for you? It contains the correct dependancy versions. (I assume ubuntu one should work, but I have not personally worked with openSUSE)

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

No branches or pull requests

2 participants