Models: TypeError: __init__() got an unexpected keyword argument 'file'

Created on 9 Jan 2018  路  7Comments  路  Source: tensorflow/models

I got this error when trying to run python object_detection/builders/model_builder_test.py

Traceback (most recent call last):
  File "object_detection/train.py", line 49, in <module>
    from object_detection import trainer
  File "/Users/stanleynguyen/Documents/Projects/tf-models/research/object_detection/trainer.py", line 27, in <module>
    from object_detection.builders import preprocessor_builder
  File "/Users/stanleynguyen/Documents/Projects/tf-models/research/object_detection/builders/preprocessor_builder.py", line 21, in <module>
    from object_detection.protos import preprocessor_pb2
  File "/Users/stanleynguyen/Documents/Projects/tf-models/research/object_detection/protos/preprocessor_pb2.py", line 71, in <module>
    options=None, file=DESCRIPTOR),
TypeError: __init__() got an unexpected keyword argument 'file'

I have followed all the steps from installation instructions without fail. Can someone please help me understand the cause of this error?

Most helpful comment

your protoc version maybe wrong,use the 2.6 version and it works well. 3.51 version cause this error.

All 7 comments

This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there. Thanks!

your environment is windows?

your protoc version maybe wrong,use the 2.6 version and it works well. 3.51 version cause this error.

@fleeaway yes it did solve my problem. Tq!

I am facing the issue at my Ubuntu 14.04:
/object_detection/protos/string_int_label_map_pb2.py", line 41, in
options=None, file=DESCRIPTOR),
TypeError: new() got an unexpected keyword argument 'file' while using protoc-3.2.0. I verified my installed protobuf version with the command "pip freeze | grep proto".
Any suggestion ??

Changing protoc-3.x.x to 2.x.x solved my same problem @arpan8514

@fleeaway or @stanleynguyen, I'm having this error when I try and build tensorflow. I didn't actually have protoc installed (or at least in my path). Does tensorflow use its own version of protoc? I installed 2x locally but am still getting the error. How do make tensorflow use my local protoc?

Was this page helpful?
0 / 5 - 0 ratings