[Bug]: RuntimeError: error checking inheritance of Ellipsis (type: ellipsis)
oliverfleetwood opened this issue · 2 comments
oliverfleetwood commented
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I'm running the tutorial notebook search_article_in_medium
you provided and the following cell fails for me with a pydandic error:
TypeError Traceback (most recent call last)
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/validators.py:268, in find_validators(type_, arbitrary_types_allowed)
267 try:
--> 268 if issubclass(type_, val_type):
269 return validators
TypeError: issubclass() arg 1 must be a class
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
Cell In[4], line 1
----> 1 from towhee import ops, pipe, DataCollection
3 insert_pipe = (pipe.input('df')
4 .flat_map('df', 'data', lambda df: df.values.tolist())
5 .map('data', 'res', ops.ann_insert.milvus_client(host='127.0.0.1',
(...)
8 .output('res')
9 )
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/towhee/__init__.py:20
1 # Copyright 2021 Zilliz. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
15 # pylint: disable=redefined-builtin
16 # pylint: disable=import-outside-toplevel
18 import sys
---> 20 from towhee.runtime import register, pipe, ops, accelerate, AutoConfig, AutoPipes
21 from towhee.data_loader import DataLoader
22 from towhee.serve.triton import triton_client
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/towhee/runtime/__init__.py:17
1 # Copyright 2021 Zilliz. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 from .factory import ops, register
---> 17 from .pipeline import Pipeline as pipe
18 from .auto_pipes import AutoPipes
19 from .auto_config import AutoConfig
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/towhee/runtime/pipeline.py:18
15 import uuid
16 from copy import deepcopy
---> 18 from towhee.runtime.check_utils import TupleForm
19 from towhee.runtime.operator_manager import OperatorAction
20 from towhee.runtime.factory import _OperatorWrapper
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/towhee/runtime/check_utils.py:36
32 raise ValueError(f'The iteration param is not valid, the [{v}]<=0.')
33 return v
---> 36 class TupleForm(BaseModel):
37 data: Optional[Tuple[str, ...]]
38 schema_data: Optional[Tuple[constr(regex='^[a-z][a-z0-9_]*$'), ...]]
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/main.py:95, in MetaModel.__new__(mcs, name, bases, namespace)
93 elif not ann_name.startswith('_') and ann_name not in namespace:
94 validate_field_name(bases, ann_name)
---> 95 fields[ann_name] = Field.infer(
96 name=ann_name,
97 value=...,
98 annotation=ann_type,
99 class_validators=vg.get_validators(ann_name),
100 config=config,
101 )
103 for var_name, value in namespace.items():
104 if not var_name.startswith('_') and not isinstance(value, TYPE_BLACKLIST) and var_name not in class_vars:
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:92, in Field.infer(cls, name, value, annotation, class_validators, config)
90 required = value == Required
91 annotation = get_annotation_from_schema(annotation, schema)
---> 92 return cls(
93 name=name,
94 type_=annotation,
95 alias=schema.alias,
96 class_validators=class_validators,
97 default=None if required else value,
98 required=required,
99 model_config=config,
100 schema=schema,
101 )
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:77, in Field.__init__(self, name, type_, class_validators, model_config, default, required, alias, schema)
75 self.parse_json: bool = False
76 self.shape: Shape = Shape.SINGLETON
---> 77 self.prepare()
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:133, in Field.prepare(self)
130 if not self.required and self.default is None:
131 self.allow_none = True
--> 133 self._populate_sub_fields()
134 self._populate_validators()
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:156, in Field._populate_sub_fields(self)
154 self.required = False
155 types_.append(type_)
--> 156 self.sub_fields = [self._create_sub_type(t, f'{self.name}_{display_as_type(t)}') for t in types_]
157 return
159 if issubclass(origin, Tuple):
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:156, in <listcomp>(.0)
154 self.required = False
155 types_.append(type_)
--> 156 self.sub_fields = [self._create_sub_type(t, f'{self.name}_{display_as_type(t)}') for t in types_]
157 return
159 if issubclass(origin, Tuple):
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:181, in Field._create_sub_type(self, type_, name, for_keys)
180 def _create_sub_type(self, type_, name, *, for_keys=False):
--> 181 return self.__class__(
182 type_=type_,
183 name=name,
184 class_validators=None if for_keys else {k: v for k, v in self.class_validators.items() if not v.whole},
185 model_config=self.model_config,
186 )
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:77, in Field.__init__(self, name, type_, class_validators, model_config, default, required, alias, schema)
75 self.parse_json: bool = False
76 self.shape: Shape = Shape.SINGLETON
---> 77 self.prepare()
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:133, in Field.prepare(self)
130 if not self.required and self.default is None:
131 self.allow_none = True
--> 133 self._populate_sub_fields()
134 self._populate_validators()
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:161, in Field._populate_sub_fields(self)
159 if issubclass(origin, Tuple):
160 self.shape = Shape.TUPLE
--> 161 self.sub_fields = [self._create_sub_type(t, f'{self.name}_{i}') for i, t in enumerate(self.type_.__args__)]
162 return
164 if issubclass(origin, List):
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:161, in <listcomp>(.0)
159 if issubclass(origin, Tuple):
160 self.shape = Shape.TUPLE
--> 161 self.sub_fields = [self._create_sub_type(t, f'{self.name}_{i}') for i, t in enumerate(self.type_.__args__)]
162 return
164 if issubclass(origin, List):
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:181, in Field._create_sub_type(self, type_, name, for_keys)
180 def _create_sub_type(self, type_, name, *, for_keys=False):
--> 181 return self.__class__(
182 type_=type_,
183 name=name,
184 class_validators=None if for_keys else {k: v for k, v in self.class_validators.items() if not v.whole},
185 model_config=self.model_config,
186 )
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:77, in Field.__init__(self, name, type_, class_validators, model_config, default, required, alias, schema)
75 self.parse_json: bool = False
76 self.shape: Shape = Shape.SINGLETON
---> 77 self.prepare()
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:134, in Field.prepare(self)
131 self.allow_none = True
133 self._populate_sub_fields()
--> 134 self._populate_validators()
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/fields.py:203, in Field._populate_validators(self)
194 if get_validators:
195 warnings.warn(
196 f'get_validators has been replaced by __get_validators__ (on {self.name})', DeprecationWarning
197 )
198 v_funcs = (
199 *tuple(v.func for v in class_validators_ if not v.whole and v.pre),
200 *(
201 get_validators()
202 if get_validators
--> 203 else find_validators(self.type_, self.model_config.arbitrary_types_allowed)
204 ),
205 *tuple(v.func for v in class_validators_ if not v.whole and not v.pre),
206 )
207 self.validators = self._prep_vals(v_funcs)
209 if class_validators_:
File ~/miniconda3/envs/py_milvus/lib/python3.11/site-packages/pydantic/validators.py:271, in find_validators(type_, arbitrary_types_allowed)
269 return validators
270 except TypeError as e:
--> 271 raise RuntimeError(f'error checking inheritance of {type_!r} (type: {display_as_type(type_)})') from e
273 if arbitrary_types_allowed:
274 return [make_arbitrary_type_validator(type_)]
RuntimeError: error checking inheritance of Ellipsis (type: ellipsis)
Expected Behavior
No response
Steps To Reproduce
1. run the notebook in a conda environment
2. execute the cells one by one
Environment
towhee 1.1.2 pyhf3ec037_0 conda-forge
pydantic 0.18.2 py_0 conda-forge
- OS(Ubuntu or CentOS): MacOS
- CPU/Memory: N/A
- GPU: N/A
- Others: running insida conda virtual env
Anything else?
No response
junjiejiangjjj commented
pydantic == 1.10.10 works fine.
stale commented
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Close the stale issues and pull requests after 7 days of inactivity. Reopen the issue with /reopen
.