Cannot Use PineconeGRPC: python pinecone-client

Can anybody actually use this? I don’t see how.

It seems that the packaged pb2 files in pinecone/core/grpc/protos/vector_service_pb2.py are not generated with a new enough protoc (especially given the pinecone-client’s protobuf 4.25.5 dependency).

Are others simply not using the grpc extension?

Installed with:
pip install pinecone-client[grpc]==5.0.1

Stacktrace

  File "<REDACTED>", line 16, in <module>
    from pinecone.grpc import PineconeGRPC
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/grpc/__init__.py", line 47, in <module>
    from .index_grpc import GRPCIndex
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/grpc/index_grpc.py", line 14, in <module>
    from .vector_factory_grpc import VectorFactoryGRPC
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/grpc/vector_factory_grpc.py", line 17, in <module>
    from .sparse_values_factory import SparseValuesFactory
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/grpc/sparse_values_factory.py", line 14, in <module>
    from pinecone.core.grpc.protos.vector_service_pb2 import (
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/core/grpc/protos/vector_service_pb2.py", line 21, in <module>
    from protoc_gen_openapiv2.options import (
  File "/usr/local/lib/python3.11/site-packages/protoc_gen_openapiv2/options/annotations_pb2.py", line 15, in <module>
    from protoc_gen_openapiv2.options import openapiv2_pb2 as protoc__gen__openapiv2_dot_options_dot_openapiv2__pb2
  File "/usr/local/lib/python3.11/site-packages/protoc_gen_openapiv2/options/openapiv2_pb2.py", line 35, in <module>
    _descriptor.EnumValueDescriptor(
  File "/home/vscode/.local/lib/python3.11/site-packages/google/protobuf/descriptor.py", line 789, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

My Python Environment

$ python --version
Python 3.11.10

$ pip freeze | grep pinecone
pinecone-client==5.0.1
pinecone-plugin-inference==1.1.0
pinecone-plugin-interface==0.0.7

$ pip freeze | grep proto
googleapis-common-protos==1.56.4
grpc-gateway-protoc-gen-openapiv2==0.1.0
proto-plus==1.24.0
protobuf==4.25.5
protoc-gen-openapiv2==0.0.1
wsproto==1.2.0

Hey, thanks for opening this. I’d recommend updating to the latest Python client - note that we dropped the -client from the name, so the package is now just called pinecone. You can find the instructions here. The latest stable version is v5.4.2.

Thank you – I’ll try that and get back

Sadly, still getting the error after installing:
pip install pinecone[grpc]==5.4.2

    from pinecone.grpc import PineconeGRPC
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/grpc/__init__.py", line 47, in <module>
    from .index_grpc import GRPCIndex
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/grpc/index_grpc.py", line 16, in <module>
    from .vector_factory_grpc import VectorFactoryGRPC
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/grpc/vector_factory_grpc.py", line 17, in <module>
    from .sparse_values_factory import SparseValuesFactory
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/grpc/sparse_values_factory.py", line 12, in <module>
    from pinecone.core.grpc.protos.vector_service_pb2 import SparseValues as GRPCSparseValues
  File "/home/vscode/.local/lib/python3.11/site-packages/pinecone/core/grpc/protos/vector_service_pb2.py", line 21, in <module>
    from protoc_gen_openapiv2.options import (
  File "/usr/local/lib/python3.11/site-packages/protoc_gen_openapiv2/options/annotations_pb2.py", line 15, in <module>
    from protoc_gen_openapiv2.options import openapiv2_pb2 as protoc__gen__openapiv2_dot_options_dot_openapiv2__pb2
  File "/usr/local/lib/python3.11/site-packages/protoc_gen_openapiv2/options/openapiv2_pb2.py", line 35, in <module>
    _descriptor.EnumValueDescriptor(
  File "/home/vscode/.local/lib/python3.11/site-packages/google/protobuf/descriptor.py", line 789, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

$ pip freeze | grep pinecone
pinecone==5.4.2
pinecone-plugin-inference==3.1.0
pinecone-plugin-interface==0.0.7

protobuf==4.25.5
protoc-gen-openapiv2==0.0.1

Sorry for the delayed reply. Are you still hitting this? If you have a clean install of the client, then it’s likely some kind of dependency issue in your environment. Running the install in a clean notebook seems to be working fine.

Thanks for getting back – we resolved the issue

we had to remove the following package from our environment: grpc-gateway-protoc-gen-openapiv2==0.1.0; after doing so, the install from scratch worked.

Thanks!