Closed jorgejesus closed 7 months ago
I see the same issue.
digging a bit deeper gives me:
python ☸ (ceph)
Python 3.11.3 (main, Apr 24 2023, 15:24:08) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from xsdata.cli import cli
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/cli.py", line 13, in <module>
from xsdata.codegen.transformer import SchemaTransformer
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/codegen/transformer.py", line 17, in <module>
from xsdata.codegen.analyzer import ClassAnalyzer
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/codegen/analyzer.py", line 3, in <module>
from xsdata.codegen.container import ClassContainer
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/codegen/container.py", line 7, in <module>
from xsdata.codegen.handlers import AddAttributeSubstitutions
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/codegen/handlers/__init__.py", line 1, in <module>
from .add_attribute_substitutions import AddAttributeSubstitutions
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/codegen/handlers/add_attribute_substitutions.py", line 6, in <module>
from xsdata.codegen.mixins import ContainerInterface
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/codegen/mixins.py", line 10, in <module>
from xsdata.models.config import GeneratorConfig
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/models/config.py", line 19, in <module>
from xsdata.formats.dataclass.context import XmlContext
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/formats/dataclass/context.py", line 13, in <module>
from xsdata.formats.dataclass.compat import class_types
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/formats/dataclass/compat.py", line 148, in <module>
load_entry_points("xsdata.plugins.class_types")
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata/utils/hooks.py", line 13, in load_entry_points
plugin.load()
File "/Users/weissl/.pyenv/versions/3.11.3/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/weissl/.pyenv/versions/3.11.3/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata_pydantic/hooks/class_type.py", line 3, in <module>
from xsdata_pydantic.compat import Pydantic
File "/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/xsdata_pydantic/compat.py", line 14, in <module>
from pydantic.validators import _VALIDATORS
ImportError: cannot import name '_VALIDATORS' from 'pydantic.validators' (/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/pydantic/validators.py)
>>> from pydantic.validators import _VALIDATORS
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name '_VALIDATORS' from 'pydantic.validators' (/Users/weissl/.pyenv/versions/stage-ingest/lib/python3.11/site-packages/pydantic/validators.py)
Which indicates the pydantic.validators
package is available in pydantic V1 and not V2
And the member _VALIDATORS
is not migrated to V2
I think the only option currently is to use pydantic V1
see #23 for pydantic v2 support, I will publish a new release, for anyone still using this library
Tried to install
xsdata-pydantic
as indicated on the docs (pip install xsdata-pydantic[cli]
) when running a xsdata command (xsdata --help
) it only outpurs:Install cli requirements "pip install xsdata[cli]"
Even doing first a
pip install xsdata[cli]
andpip install xsdata-pydantic[cli]
it outputs the same error message. This can be tested using this dockerfile:Running: