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

Protobuf error when importing both google cloud and clarifai #90

Closed
ghost opened this issue Sep 17, 2018 · 2 comments
Closed

Protobuf error when importing both google cloud and clarifai #90

ghost opened this issue Sep 17, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 17, 2018

`Python 2.7.15 (default, Jun 27 2018, 13:05:28)
[GCC 8.1.1 20180531] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from clarifai.rest import ClarifaiApp
from google.cloud import speech
Traceback (most recent call last):
File "", line 1, in
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/cloud/speech.py", line 17, in
from google.cloud.speech_v1 import SpeechClient
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/cloud/speech_v1/init.py", line 17, in
from google.cloud.speech_v1.gapic import speech_client
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/cloud/speech_v1/gapic/speech_client.py", line 22, in
import google.api_core.operation
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/api_core/operation.py", line 45, in
from google.longrunning import operations_pb2
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/longrunning/operations_pb2.py", line 23, in
from google.longrunning.operations_grpc_pb2 import *
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/longrunning/operations_grpc_pb2.py", line 16, in
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/api/annotations_pb2.py", line 16, in
from google.api import http_pb2 as google_dot_api_dot_http__pb2
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/api/http_pb2.py", line 22, in
serialized_pb=_b('\n\x15google/api/http.proto\x12\ngoogle.api"+\n\x04Http\x12#\n\x05rules\x18\x01 \x03(\x0b\x32\x14.google.api.HttpRule"\xea\x01\n\x08HttpRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12\r\n\x03get\x18\x02 \x01(\tH\x00\x12\r\n\x03put\x18\x03 \x01(\tH\x00\x12\x0e\n\x04post\x18\x04 \x01(\tH\x00\x12\x10\n\x06\x64\x65lete\x18\x05 \x01(\tH\x00\x12\x0f\n\x05patch\x18\x06 \x01(\tH\x00\x12/\n\x06\x63ustom\x18\x08 \x01(\x0b\x32\x1d.google.api.CustomHttpPatternH\x00\x12\x0c\n\x04\x62ody\x18\x07 \x01(\t\x12\x31\n\x13\x61\x64\x64itional_bindings\x18\x0b \x03(\x0b\x32\x14.google.api.HttpRuleB\t\n\x07pattern"/\n\x11\x43ustomHttpPattern\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\tB'\n\x0e\x63om.google.apiB\tHttpProtoP\x01\xf8\x01\x01\xa2\x02\x04GAPIb\x06proto3')
File "/home/jonm/Code/venv2/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 878, in new
return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "google/api/http.proto":
google.api.Http.rules: "google.api.Http.rules" is already defined in file "proto/google/api/http.proto".
google.api.Http: "google.api.Http" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.pattern: "google.api.HttpRule.pattern" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.selector: "google.api.HttpRule.selector" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.get: "google.api.HttpRule.get" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.put: "google.api.HttpRule.put" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.post: "google.api.HttpRule.post" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.delete: "google.api.HttpRule.delete" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.patch: "google.api.HttpRule.patch" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.custom: "google.api.HttpRule.custom" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.body: "google.api.HttpRule.body" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule.additional_bindings: "google.api.HttpRule.additional_bindings" is already defined in file "proto/google/api/http.proto".
google.api.HttpRule: "google.api.HttpRule" is already defined in file "proto/google/api/http.proto".
google.api.CustomHttpPattern.kind: "google.api.CustomHttpPattern.kind" is already defined in file "proto/google/api/http.proto".
google.api.CustomHttpPattern.path: "google.api.CustomHttpPattern.path" is already defined in file "proto/google/api/http.proto".
google.api.CustomHttpPattern: "google.api.CustomHttpPattern" is already defined in file "proto/google/api/http.proto".
google.api.Http.rules: "google.api.HttpRule" seems to be defined in "proto/google/api/http.proto", which is not imported by "google/api/http.proto". To use it here, please add the necessary import.
google.api.HttpRule.custom: "google.api.CustomHttpPattern" seems to be defined in "proto/google/api/http.proto", which is not imported by "google/api/http.proto". To use it here, please add the necessary import.
google.api.HttpRule.additional_bindings: "google.api.HttpRule" seems to be defined in "proto/google/api/http.proto", which is not imported by "google/api/http.proto". To use it here, please add the necessary import.
`

@rok-povsic
Copy link
Contributor

rok-povsic commented Sep 18, 2018

@mooreubc Hi, thanks for reporting this, we're looking into a solution for this issue.

Before we release a fix, to use the client with the google cloud speech library, please downgrade to the clarifai version 2.2.3.

OR if you want to keep the latest version, here's a quick-and-dirty solution you can apply yourself, assuming you have the latest clarifai 2.3.1:

  1. Uninstall the binary protobuf and install a pure Python implementation:
pip uninstall protobuf
pip install --no-binary=protobuf protobuf
  1. , open site-packages/clarifai/rest/grpc/proto/clarifai/api/endopoint_pb2.py and change the line 33 from
from clarifai.rest.grpc.proto.google.api import annotations_pb2 as proto_dot_google_dot_api_dot_annotations__pb2

to

from google.api import annotations_pb2 as proto_dot_google_dot_api_dot_annotations__pb2

We'll try to release a proper fix ASAP.

@rok-povsic
Copy link
Contributor

@mooreubc The issue is fixed now. Please upgrade to the latest 2.3.2 version and tell us if you still find anything amiss. Thanks.

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

No branches or pull requests

1 participant