Pydantic 2 does not support all of the V1 capabilities
hello. Trying to launch zwave-js-server-python, but it terminates with import error.
Install was done with pip3 install zwave-js-server-python
Launching it, I get the error below:
$ ./zwave-js-server-python
Traceback (most recent call last):
File "./zwave-js-server-python", line 5, in <module>
from zwave_js_server.__main__ import main
File "/home/chr/.local/lib/python3.8/site-packages/zwave_js_server/__main__.py", line 9, in <module>
from .client import Client
File "/home/chr/.local/lib/python3.8/site-packages/zwave_js_server/client.py", line 28, in <module>
from .model.driver import Driver
File "/home/chr/.local/lib/python3.8/site-packages/zwave_js_server/model/driver.py", line 4, in <module>
from pydantic import create_model_from_typeddict
File "/home/chr/.local/lib/python3.8/site-packages/pydantic/__init__.py", line 218, in __getattr__
return _getattr_migration(attr_name)
File "/home/chr/.local/lib/python3.8/site-packages/pydantic/_migration.py", line 300, in wrapper
raise PydanticImportError(f'`{import_path}` has been removed in V2.')
pydantic.errors.PydanticImportError: `pydantic:create_model_from_typeddict` has been removed in V2.
For further information visit https://errors.pydantic.dev/2.4/u/import-error
Downgrade pydantic to 1.10 and everything should work as is. Thanks for the report though, maybe we aren't as ready for pydantic 2 as we thought
np. happy to have helped testing. thanks for a nice client library!
It seems like its available in the v1 shims, so that is surprising:
$ pip3 install pydantic==2.4.2
$ python3
>>> from pydantic.v1 import create_model_from_typeddict
>>>
hmm that's weird. @chrand is it possible you were on an earlier version of v2 that didn't have this shim?
Is this just an older version of zwave-js-server-python without the shims? Seems like it could be based on the line numbers.
Edit: Yeah, would be helpful to know version of zwave-js-server-python and pydantic involved