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: issubclass() arg 1 must be a class #175

Closed
gaurav274 opened this issue May 23, 2023 · 7 comments
Closed

TypeError: issubclass() arg 1 must be a class #175

gaurav274 opened this issue May 23, 2023 · 7 comments

Comments

@gaurav274
Copy link

import qdrant_client does not work for python3.8 and python3.9.

@joein
Copy link
Member

joein commented May 23, 2023

Hello @gaurav274
Could you please provide qdrant-client version and full log?

@gaurav274
Copy link
Author

Hello @gaurav274 Could you please provide qdrant-client version and full log?

Yes, @joein

Name: qdrant-client
Version: 1.1.4
Summary: Client library for the Qdrant vector search engine
Home-page: https://github.com/qdrant/qdrant-client
Author: Andrey Vasnetsov
Author-email: andrey@qdrant.tech
License: 
Location: /test38/lib/python3.8/site-packages
Requires: grpcio, grpcio-tools, httpx, numpy, pydantic, typing-extensions, urllib3

Logs:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 import qdrant_client

File /test38/lib/python3.8/site-packages/qdrant_client/__init__.py:1
----> 1 from .qdrant_client import QdrantClient as QdrantClient

File /test38/lib/python3.8/site-packages/qdrant_client/qdrant_client.py:4
      1 from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
      3 from qdrant_client import grpc as grpc
----> 4 from qdrant_client.client_base import QdrantBase
      5 from qdrant_client.conversions import common_types as types
      6 from qdrant_client.http import ApiClient, SyncApis

File /test38/lib/python3.8/site-packages/qdrant_client/client_base.py:3
      1 from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
----> 3 from qdrant_client.conversions import common_types as types
      4 from qdrant_client.http import models
      7 class QdrantBase:

File /test38/lib/python3.8/site-packages/qdrant_client/conversions/common_types.py:13
     10 from typing import List, Union
     12 from qdrant_client import grpc as grpc
---> 13 from qdrant_client.http import models as rest
     15 Filter = Union[rest.Filter, grpc.Filter]
     16 SearchParams = Union[rest.SearchParams, grpc.SearchParams]

File /test38/lib/python3.8/site-packages/qdrant_client/http/__init__.py:4
      1 import inspect
      3 from pydantic import BaseModel
----> 4 from qdrant_client.http.api_client import (  # noqa F401
      5     ApiClient as ApiClient,
      6     AsyncApis as AsyncApis,
      7     SyncApis as SyncApis,
      8 )
      9 from qdrant_client.http.models import models as models  # noqa F401
     11 for model in inspect.getmembers(models, inspect.isclass):

File /test38/lib/python3.8/site-packages/qdrant_client/http/api_client.py:7
      5 from httpx import AsyncClient, Client, Request, Response
      6 from pydantic import ValidationError
----> 7 from qdrant_client.http.api.cluster_api import AsyncClusterApi, SyncClusterApi
      8 from qdrant_client.http.api.collections_api import AsyncCollectionsApi, SyncCollectionsApi
      9 from qdrant_client.http.api.points_api import AsyncPointsApi, SyncPointsApi

File /test38/lib/python3.8/site-packages/qdrant_client/http/api/cluster_api.py:9
      7 from pydantic.json import ENCODERS_BY_TYPE
      8 from pydantic.main import BaseModel
----> 9 from qdrant_client.http.models import *
     10 from qdrant_client.http.models import models as m
     12 SetIntStr = Set[Union[int, str]]

File /test38/lib/python3.8/site-packages/qdrant_client/http/models/__init__.py:1
----> 1 from .models import *

File /test38/lib/python3.8/site-packages/qdrant_client/http/models/models.py:63
     59     p2p: "P2pConfigTelemetry" = Field(..., description="")
     60     consensus: "ConsensusConfigTelemetry" = Field(..., description="")
---> 63 class ClusterStatusOneOf(BaseModel):
     64     status: Literal[
     65         "disabled",
     66     ] = Field(..., description="")
     69 class ClusterStatusOneOf1(BaseModel):

File /test38/lib/python3.8/site-packages/pydantic/main.py:197, in pydantic.main.ModelMetaclass.__new__()

File /test38/lib/python3.8/site-packages/pydantic/fields.py:506, in pydantic.fields.ModelField.infer()

File /test38/lib/python3.8/site-packages/pydantic/fields.py:436, in pydantic.fields.ModelField.__init__()

File /test38/lib/python3.8/site-packages/pydantic/fields.py:552, in pydantic.fields.ModelField.prepare()

File /test38/lib/python3.8/site-packages/pydantic/fields.py:668, in pydantic.fields.ModelField._type_analysis()

File /usr/local/lib/python3.8/typing.py:774, in _GenericAlias.__subclasscheck__(self, cls)
    772 if self._special:
    773     if not isinstance(cls, _GenericAlias):
--> 774         return issubclass(cls, self.__origin__)
    775     if cls._special:
    776         return issubclass(cls.__origin__, self.__origin__)

TypeError: issubclass() arg 1 must be a class```

@gaurav274
Copy link
Author

Found a related issue - langchain-ai/langchain#5113

@joein
Copy link
Member

joein commented May 23, 2023

Great thread, thanks

Seems like the issue is related to a recent typing_extensions update

pip3 install typing_extensions==4.5.0 fixes the issue for me

@joein
Copy link
Member

joein commented May 23, 2023

@gaurav274 we will set typing-extensions = ">=4.0.0,<4.6.0" in the upcoming release

@kenhktsui
Copy link

Great thread, thanks

Seems like the issue is related to a recent typing_extensions update

pip3 install typing_extensions==4.5.0 fixes the issue for me

iIt works for me too!

@generall
Copy link
Member

should be fixed in 1.2.0

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

4 participants