Skip to content

[Bug] asyncio sdk error when deleting vectors #564

@swmoon00

Description

@swmoon00

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing Github issues and Community Forum, and I could not find an existing post for this bug

Describe the bug
I am using pinecone python client with asyncio. When I try to delete the vectors from my index, the asyncio sdk client gives me an error.

Error information

Traceback (most recent call last):
  File "/Users/tony/tl-embed/repro.py", line 42, in <module>
    asyncio.run(main())
  File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/tony/tl-embed/repro.py", line 36, in main
    await model_index.delete(namespace="test-namespace", delete_all=True)
  File "/Users/tony/tl-embed/.venv/lib/python3.12/site-packages/pinecone/db_data/index_asyncio.py", line 410, in delete
    result = await self._vector_api.delete_vectors(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tony/tl-embed/.venv/lib/python3.12/site-packages/pinecone/openapi_support/asyncio_endpoint.py", line 90, in __call__
    return await self.callable(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tony/tl-embed/.venv/lib/python3.12/site-packages/pinecone/core/openapi/db_data/api/vector_operations_api.py", line 975, in __delete_vectors
    return cast(Dict[str, Any], await self.call_with_http_info(**kwargs))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tony/tl-embed/.venv/lib/python3.12/site-packages/pinecone/openapi_support/asyncio_endpoint.py", line 122, in call_with_http_info
    return await self.api_client.call_api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tony/tl-embed/.venv/lib/python3.12/site-packages/pinecone/openapi_support/asyncio_api_client.py", line 274, in call_api
    return await self.__call_api(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tony/tl-embed/.venv/lib/python3.12/site-packages/pinecone/openapi_support/asyncio_api_client.py", line 182, in __call_api
    setattr(return_data, "_response_info", response_info)
AttributeError: 'str' object has no attribute '_response_info'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x106d64ec0>
Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x1076876b0>, 139630.271451083)])']
connector: <aiohttp.connector.TCPConnector object at 0x107608920>

Steps to reproduce the issue locally
First, run the pinecone-local container on the local machine.

docker run -it --rm \
  --name pinecone \
  --platform linux/amd64 \
  -e PORT=15080 \
  -e PINECONE_HOST=localhost \
  -p 15080-15090:15080-15090 \
  ghcr.io/pinecone-io/pinecone-local:latest

Then run the repro code.

"""Repro."""
import asyncio

import numpy as np
import pinecone


async def main():
    """Repro main."""
    index_name = "test-pinecone-index"
    pinecone_client = pinecone.Pinecone(api_key="test-api-key", host="http://localhost:15080")

    if pinecone_client.has_index(index_name):
        pinecone_client.delete_index(index_name)

    pinecone_client.create_index(
        name=index_name,
        dimension=512,
        metric="cosine",
        spec=pinecone.ServerlessSpec(cloud="aws", region="us-east-1"),
        deletion_protection="disabled",
    )

    index_host = f"http://{pinecone_client.describe_index(index_name)['host']}"

    model_index = pinecone_client.IndexAsyncio(host=index_host)

    await model_index.upsert(
        vectors=[
            ("vec1", np.random.rand(512).astype(np.float32).tolist()),
            ("vec2", np.random.rand(512).astype(np.float32).tolist()),
        ],
        namespace="test-namespace",
    )

    await model_index.delete(namespace="test-namespace", delete_all=True)

    pinecone_client.delete_index(index_name)


if __name__ == "__main__":
    asyncio.run(main())

Environment

  • OS Version: MacOS Tahoe 26.1
  • Python version: 3.12.12
  • Python SDK version: 8.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus:needs-triageAn issue that needs to be triaged by the Pinecone team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions