Closed TizianoBevilacqua closed 9 months ago
Can you check what pydantic version you have installed? e.g.
import pydantic
print(pydantic.__version__)
v 2.4.2
Ok. This is likely the reason, and a bit puzzling since in the installation we restrict to pydantic < 2 due to not migrating the code to be compatible: https://github.com/cms-nanoAOD/correctionlib/blob/42a327e093d43b2cbc8c2a7c0fed69a430c482fb/setup.cfg#L32
In what environment are you installing correctionlib? Does the pip install
warn about incompatibilities?
I am using a coffea/higgsDNA environment and I wasn't specifying any requirement for pydantic. If I reinstall it with pydantic <2,>=1.7.3
it seems to work just fine.
Thank you :)
Ok, so the problem's origin is understood, but I don't see why the installation did not respect the version pinning in correctionlib. Regardless, we need to make correctionlib pydantic2-compatible.
Actually I'm a bit puzzled because even in v2.4.2 and the latest correctionlib I can't recreate this exact error.
Hi all, I have a problem creating new json files with correctionlib schema v2, I used to use this (working in the past) code to create a multibinned SF json, but now I get an error regarding a missing default field:
I've tried to add the missing fields pydantic was complaining about and I arrived to this version of the same function:
This solves the creation of the correction (it also prints out just fine), but if I try to convert it with to_evaluator() I get again an error:
Ultimately I've changed this line in schemav2.py:
to this:
and it doesn't complain anymore, it is not a good fix but at least pinpoint the problem for me