matthiaskoenig / sbmlutils

Python utilities for SBML
https://sbmlutils.readthedocs.io/en/stable/
GNU Lesser General Public License v3.0
37 stars 12 forks source link

pydantic error #434

Closed shoepfl closed 1 year ago

shoepfl commented 1 year ago

Hi Matthias,

currently I get a pydantic error, when using sbmlutils 0.8.4:

UserWarning: Field "modelunits" has conflict with protected namespace "model".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = (). warnings.warn( /home/basti/miniconda3/envs/sbmlutils/lib/python3.11/site-packages/pydantic/_internal/_fields.py:127: UserWarning: Field "modeldefinitions" has conflict with protected namespace "model".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = (). warnings.warn( ───────────────────────────────────────────────────────────────────────────────────── Create SBML ────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last): File "/mnt/c/Users/basti/Documents/Uni/11_Doktorarbeit/Python/BayModTS/test.py", line 74, in results = create_model( ^^^^^^^^^^^^^ File "/home/basti/miniconda3/envs/sbmlutils/lib/python3.11/site-packages/sbmlutils/factory.py", line 3619, in create_model m = Model.merge_models(model) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/basti/miniconda3/envs/sbmlutils/lib/python3.11/site-packages/sbmlutils/factory.py", line 3445, in merge_models kind = m2._keys.get(key, None) ^^^^^^^^ File "/home/basti/miniconda3/envs/sbmlutils/lib/python3.11/site-packages/pydantic/main.py", line 711, in getattr return self.pydantic_private[item] # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/basti/miniconda3/envs/sbmlutils/lib/python3.11/site-packages/pydantic/main.py", line 715, in getattr__ pydantic_extra = object.getattribute(self, 'pydantic_extra') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Model' object has no attribute 'pydantic_extra'. Did you mean: 'pydantic_complete__'?

The error occours now in the file I already sent you for the RTD function: test.py.txt

for me this seems to be a problem with my dependencies - can you help me here?

Thanks, Sebastian

matthiaskoenig commented 1 year ago

Hi @shoepfl, this is most likely due to the latest pydantic release. Downgrading pydantic to <2.0 should fix this. I will provide a bugfix asap. Best Matthias

shoepfl commented 1 year ago

Thanks @matthiaskoenig,

i succeeded with pydantic 1.10.2

Best, Sebastian

harveymannering commented 1 year ago

We also had this issue, which was causing tests to fail. We fixed this by downgrading pydantic to <2.0.

matthiaskoenig commented 1 year ago

This is fixed in the latest version 0.8.5