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

pydantic.errors.PydanticUserError #769

Closed
BillboardsAreAllLearing opened this issue Sep 14, 2023 · 23 comments
Closed

pydantic.errors.PydanticUserError #769

BillboardsAreAllLearing opened this issue Sep 14, 2023 · 23 comments

Comments

@BillboardsAreAllLearing
Copy link

BillboardsAreAllLearing commented Sep 14, 2023

To help people understand your problems, run sudo pkill -f input-remapper && input-remapper-gtk -d, reproduce the problem and then share the output here:

Traceback (most recent call last):
  File "/usr/bin/input-remapper-control", line 31, in <module>
    from inputremapper.configs.migrations import migrate
  File "/usr/lib/python3.11/site-packages/inputremapper/configs/migrations.py", line 50, in <module>
    from inputremapper.configs.input_config import InputCombination, InputConfig
  File "/usr/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 51, in <module>
    class InputConfig(BaseModel):
  File "/usr/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 253, in InputConfig
    @root_validator
     ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 222, in root_validator
    return root_validator()(*__args)  # type: ignore
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 228, in root_validator
    raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.

For further information visit https://errors.pydantic.dev/2.3/u/root-validator-pre-skip

I obtain this error when starting input-remapper-control. I can't use as well input-remapper-control -h. This is built from head on git via this AUR package on Arch Linux, aur.archlinux.org/packages/input-remapper-git.

@Node815
Copy link

Node815 commented Sep 15, 2023

I have the same exact error:

  File "/usr/bin/input-remapper-gtk", line 39, in <module>
    from inputremapper.gui.reader_service import ReaderService
  File "/usr/lib/python3.11/site-packages/inputremapper/gui/reader_service.py", line 55, in <module>
    from inputremapper.configs.input_config import InputCombination, InputConfig
  File "/usr/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 51, in <module>
    class InputConfig(BaseModel):
  File "/usr/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 253, in InputConfig
    @root_validator
     ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 222, in root_validator
    return root_validator()(*__args)  # type: ignore
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 228, in root_validator
    raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.

For further information visit https://errors.pydantic.dev/2.3/u/root-validator-pre-skip

Fresh install as of 2 days ago for Arch after upgrading SSD.

@7abc39bd7efb38
Copy link

7abc39bd7efb38 commented Sep 17, 2023

Same. I'm on Fedora 38
Tried installing using dnf and manually. Same result both times.

Traceback (most recent call last):
  File "/usr/bin/input-remapper-gtk", line 39, in <module>
    from inputremapper.gui.reader_service import ReaderService
  File "/usr/local/lib/python3.11/site-packages/inputremapper/gui/reader_service.py", line 55, in <module>
    from inputremapper.configs.input_config import InputCombination, InputConfig
  File "/usr/local/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 51, in <module>
    class InputConfig(BaseModel):
  File "/usr/local/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 253, in InputConfig
    @root_validator
     ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 222, in root_validator
    return root_validator()(*__args)  # type: ignore
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 228, in root_validator
    raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.

For further information visit https://errors.pydantic.dev/2.2/u/root-validator-pre-skip

@M8850
Copy link

M8850 commented Sep 17, 2023

same on arch prolly after update

[2023-09-16T14:17:39+0200] [ALPM] upgraded python-matplotlib (3.7.2-1 -> 3.7.3-1)
[2023-09-16T21:03:35+0200] [ALPM] upgraded python-contourpy (1.1.0-1 -> 1.1.1-1)
[2023-09-17T05:38:26+0200] [ALPM] upgraded glslang (12.3.1-2 -> 13.0.0-1)
[2023-09-17T05:38:26+0200] [ALPM] upgraded libplacebo (5.264.1-2 -> 5.264.1-3)
[2023-09-17T05:38:26+0200] [ALPM] installed python-annotated-types (0.5.0-1)
[2023-09-17T05:38:26+0200] [ALPM] installed python-pydantic-core (1:2.6.3-1)
[2023-09-17T05:38:27+0200] [ALPM] upgraded python-pydantic (1.10.9-1 -> 2.3.0-1)
[2023-09-17T05:38:27+0200] [ALPM] upgraded python-inflect (7.0.0-1 -> 7.0.0-2)
[2023-09-17T05:38:27+0200] [ALPM] upgraded remmina (1:1.4.31-1 -> 1:1.4.32-1)
[2023-09-17T05:38:27+0200] [ALPM] upgraded suitesparse (7.1.0-2 -> 7.2.0-2)
╰─>$ input-remapper-gtk
Traceback (most recent call last):
  File "/usr/bin/input-remapper-gtk", line 39, in <module>
    from inputremapper.gui.reader_service import ReaderService
  File "/usr/lib/python3.11/site-packages/inputremapper/gui/reader_service.py", line 55, in <module>
    from inputremapper.configs.input_config import InputCombination, InputConfig
  File "/usr/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 51, in <module>
    class InputConfig(BaseModel):
  File "/usr/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 253, in InputConfig
    @root_validator
     ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 222, in root_validator
    return root_validator()(*__args)  # type: ignore
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 228, in root_validator
    raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.

For further information visit https://errors.pydantic.dev/2.3/u/root-validator-pre-skip

@tchofy
Copy link

tchofy commented Sep 17, 2023

I'm on arch as well, downgrading just python-pydantic makes it work again for me, but it might cause problems if you use other packages that rely on it.

@jeandelafontaine18
Copy link

Traceback (most recent call last):
File "/usr/bin/input-remapper-gtk", line 39, in
from inputremapper.gui.reader_service import ReaderService
File "/usr/lib/python3.11/site-packages/inputremapper/gui/reader_service.py", line 55, in
from inputremapper.configs.input_config import InputCombination, InputConfig
File "/usr/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 51, in
class InputConfig(BaseModel):
File "/usr/lib/python3.11/site-packages/inputremapper/configs/input_config.py", line 253, in InputConfig
@root_validator
^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 222, in root_validator
return root_validator()(*__args) # type: ignore
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 228, in root_validator
raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use @root_validator with pre=False (the default) you MUST specify skip_on_failure=True. Note that @root_validator is deprecated and should be replaced with @model_validator.

For further information visit https://errors.pydantic.dev/2.3/u/root-validator-pre-skip

@jeandelafontaine18
Copy link

I'm on arch as well, downgrading just python-pydantic makes it work again for me, but it might cause problems if you use other packages that rely on it.

what version did you downgrade ? thx

@tchofy
Copy link

tchofy commented Sep 17, 2023

I'm on arch as well, downgrading just python-pydantic makes it work again for me, but it might cause problems if you use other packages that rely on it.

what version did you downgrade ? thx

python-pydantic 1.10.9-1 specifically. The update from 1.10.9-1 to 2.3.0 was what broke input-remapper for me.

@Delta-in-hub
Copy link

Same issue on arch.

@jeandelafontaine18
Copy link

I'm on arch as well, downgrading just python-pydantic makes it work again for me, but it might cause problems if you use other packages that rely on it.

what version did you downgrade ? thx

python-pydantic 1.10.9-1 specifically. The update from 1.10.9-1 to 2.3.0 was what broke input-remapper for me.

worked for me tho, thanks man

@7abc39bd7efb38
Copy link

7abc39bd7efb38 commented Sep 18, 2023

Thanks for your help. I was able to get it working by doing the following:

sudo pip install -U pydantic==1.10.9  
sudo pip install --no-binary :all: git+https://github.com/sezanzeb/input-remapper.git@6054125   

I also used v1.5.1 of input-remapper. I'm sure 2.0 would work just fine, but installing one using dnf and the other via pip I didn't want to mess. I'd rather roll back to what I know worked for me. Also, for some reason I had to use the commit hash instead of the v1.5.1 tag.

@Lancaban
Copy link

I am stuck, I am having the same problem, but when trying to downgrade/install as mentioned by others above, pip gives me a warning about an externally managed environment.

I tried manually downloading the older version and installing with Pacman -U
I tried installing through pipx

still can not start the service, and get the same error messages

@kjozsa
Copy link

kjozsa commented Sep 18, 2023

@Lancaban fellow arch user here. You can try to do sudo pip install -U pydantic==1.10.9 --break-system-packages until the issue gets fixed in the upstream, it made input-remapper work for me again.

@Lancaban
Copy link

That did the trick!

Thank you so much!!!

@LumenYoung
Copy link

To which upstream should this problem be reported to? Is it already reported or should some of us do that?

I manage to make it work by downgrading the pydantic but I think it should only be a temporary workaround.

Bests

@kjozsa
Copy link

kjozsa commented Sep 18, 2023

I'd assume that input-remapper's source code needs to
a) adapt to the new pydantic
b) hardwire the old pydantic as its dependency

@LumenYoung
Copy link

LumenYoung commented Sep 18, 2023

I'd assume that input-remapper's source code needs to a) adapt to the new pydantic b) hardwire the old pydantic as its dependency

It seems that input-remapper should adapt to the newer pydantic. But I assume that sezanzeb is not very active right now (As his profile README suggests).

@ChonkaLoo
Copy link

sudo pip install -U pydantic==1.10.9 --break-system-packages

is it possible to have the old pydantic installed via pip and the new one via package manager at the same time or will it conflict?

@LumenYoung
Copy link

sudo pip install -U pydantic==1.10.9 --break-system-packages

is it possible to have the old pydantic installed via pip and the new one via package manager at the same time or will it conflict?

I think it is possible if you create manually a venv for pydantic and specify that python version as the starting env for input-remapper. I don't need it right now since I don't have something rely on pydantic right now. You might have a try, I don't think it would be a problem.

@stasadev
Copy link
Contributor

Everyone is welcome to try #773, it works with both pydantic v1 and v2.

@stasadev
Copy link
Contributor

stasadev commented Sep 18, 2023

Edit: Just rebuild the package, no need to patch.


For Arch users, add this to PKGBUILD:

source+=("pydantic.patch::https://github.com/sezanzeb/input-remapper/commit/1ee15f86aff83844a359227b12163db915af2eeb.patch")
prepare() {
	cd "$srcdir"/"$_gitname"
	patch -Np1 -i "$srcdir/pydantic.patch"
}

@JurgenCruz
Copy link

If I ran the sudo pip install -U pydantic==1.10.9 --break-system-packages command, what do I need to do to revert to version 2?

@stasadev
Copy link
Contributor

stasadev commented Sep 19, 2023

@SuperJugy run this (if you are using Arch):

sudo pacman -S --overwrite "*" python-pydantic

@pythcoiner
Copy link

i've got the same issue on arch, downgrading pydantic from cache works well for me:

sudo pacman -U /var/cache/pacman/pkg/python-pydantic-1.10.9-1-x86_64.pkg.tar.zst

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