Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Instance and class checks can only be used with @runtime_checkable protocols #3869

Closed
94bb494nd41f opened this issue May 24, 2023 · 3 comments

Comments

@94bb494nd41f
Copy link

importing results in following crash:

(quanization) C:\Users\derdi\local_llama>python
Python 3.10.11 | packaged by Anaconda, Inc. | (main, Apr 20 2023, 18:56:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import llama_index
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\__init__.py", line 18, in <module>
    from llama_index.indices.common.struct_store.base import SQLDocumentContextBuilder
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\__init__.py", line 4, in <module>
    from llama_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\keyword_table\__init__.py", line 4, in <module>
    from llama_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\keyword_table\base.py", line 18, in <module>
    from llama_index.indices.base import BaseGPTIndex
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\base.py", line 8, in <module>
    from llama_index.indices.base_retriever import BaseRetriever
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\base_retriever.py", line 5, in <module>
    from llama_index.indices.query.schema import QueryBundle, QueryType
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\query\__init__.py", line 3, in <module>
    from llama_index.indices.query.response_synthesis import ResponseSynthesizer
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\query\response_synthesis.py", line 5, in <module>
    from llama_index.indices.postprocessor.types import BaseNodePostprocessor
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\postprocessor\__init__.py", line 4, in <module>
    from llama_index.indices.postprocessor.node import (
  File "C:\Users\derdi\.conda\envs\quanization\lib\site-packages\llama_index\indices\postprocessor\node.py", line 236, in <module>
    class AutoPrevNextNodePostprocessor(BasePydanticNodePostprocessor):
  File "pydantic\main.py", line 197, in pydantic.main.ModelMetaclass.__new__
  File "pydantic\fields.py", line 506, in pydantic.fields.ModelField.infer
  File "pydantic\fields.py", line 436, in pydantic.fields.ModelField.__init__
  File "pydantic\fields.py", line 557, in pydantic.fields.ModelField.prepare
  File "pydantic\fields.py", line 831, in pydantic.fields.ModelField.populate_validators
  File "pydantic\validators.py", line 725, in find_validators
  File "pydantic\dataclasses.py", line 478, in make_dataclass_validator
    else:
  File "pydantic\dataclasses.py", line 231, in pydantic.dataclasses.dataclass

  File "pydantic\dataclasses.py", line 224, in pydantic.dataclasses.dataclass.wrap

  File "pydantic\dataclasses.py", line 347, in pydantic.dataclasses._add_pydantic_validation_attributes
    self.repr = repr
  File "pydantic\dataclasses.py", line 400, in pydantic.dataclasses.create_pydantic_model_from_dataclass
    def _tuple_str(obj_name, fields):
  File "pydantic\main.py", line 1026, in pydantic.main.create_model
  File "pydantic\main.py", line 197, in pydantic.main.ModelMetaclass.__new__
  File "pydantic\fields.py", line 506, in pydantic.fields.ModelField.infer
  File "pydantic\fields.py", line 436, in pydantic.fields.ModelField.__init__
  File "pydantic\fields.py", line 552, in pydantic.fields.ModelField.prepare
  File "pydantic\fields.py", line 639, in pydantic.fields.ModelField._type_analysis
  File "C:\Users\derdi\.conda\envs\quanization\lib\typing.py", line 1498, in __instancecheck__
    raise TypeError("Instance and class checks can only be used with"
TypeError: Instance and class checks can only be used with @runtime_checkable protocols
>>> 
@logan-markewich
Copy link
Collaborator

This is fixed in the latest release, can you try upgrading? pip install --upgrade llama-index

@wilmerhenao
Copy link

This is fixed in the latest release, can you try upgrading? pip install --upgrade llama-index

Didn't work for me for some reason. However pip3 install llama-index==0.6.10.post1 did

@logan-markewich
Copy link
Collaborator

@wilmerhenao good to know! Glad it worked at least 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants