ImportError: cannot import name 'YamlModel' from 'pydantic_yaml'

Viewed 31

I am working at blender script, where I want to use YAML. So I try to import it:

from pydantic import BaseModel
from pydantic_yaml import YamlModel

But when I run my script, this error will occure:

ImportError: cannot import name 'YamlModel' from 'pydantic_yaml' (C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pydantic_yaml\__init__.py)

I have installed pydantic and pydantic_yaml on both Pythons (Blender one and the common one), if they wouldn't be installed, there would be different error. I tried googling, but google had very few results for this problem. Also, when I open that __init__.py file, there is clearly YamlModel. Thank you for any kind of help.

1 Answers

I found the same error and it is related how pydantic-yaml got installed.

There is a bug in the package. you need to install optional dependencies as well (so called extras).

pip install pedantic-yaml[pyyaml,ruamel]

or manually install pyyaml ruamel please make sure that that Taumel version is <=0.18

Related