0
$\begingroup$

Whenever I use following command

ros2 launch usb_cam camera.launch.py

Gives me the following error like this

[INFO] [launch]: All log files can be found below /home/ankit/.ros/log/2024-01-08-15-44-37-775903-ankit-vm-6485
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [py]: 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.5/u/root-validator-pre-skip

Can anyone help how would I use usb_cam.

$\endgroup$
2
  • 1
    $\begingroup$ did you research the info in the error message? ... how did it fail to resolve the issue? $\endgroup$
    – jsotola
    Commented Jan 8 at 17:42
  • $\begingroup$ Yes Sir, I have tried all possible way and I have also gone through the documentation part, but still it can't be resolved. $\endgroup$ Commented Jan 10 at 14:40

2 Answers 2

1
$\begingroup$

Try installing the earlier version of pydantic:

pip install pydantic==1.10.9
$\endgroup$
0
$\begingroup$

The solution is generally in the error message - that is what they are for, after all.

The important part of the error message is this part:

Caught exception when trying to load file of format [py]: 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`.

If you then google that string, inside double quotes (""), you will usually be directed to a Python error reported on Stack Overflow, as in this case...

From SO - PydanticUserError: If you use @root_validator with pre=False (the default) you MUST specify skip_on_failure=True


This comment states:

Pydantic got a new major version recently. It seems like the library you are using uses pydantic somewhere. May be an issue of the library code. You could track down, from which library it comes from.

This answer, as patsyuk's answer, states:

In my env, I have

pip list | grep pydantic
pydantic                     2.2.1 

I fix the problem, by downgrading pydantic version

pip install pydantic==1.10.9
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.