models icon indicating copy to clipboard operation
models copied to clipboard

got an unexpected keyword argument "serialized_options", centos 7

Open InomjonRamatov opened this issue 8 years ago • 39 comments

Please go to Stack Overflow for help and support:

http://stackoverflow.com/questions/tagged/tensorflow

Also, please understand that many of the models included in this repository are experimental and research-style code. If you open a GitHub issue, here is our policy:

  1. It must be a bug, a feature request, or a significant problem with documentation (for small docs fixes please send a PR instead).
  2. The form below must be filled out.

Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.


System information

  • What is the top-level directory of the model you are using:
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
  • TensorFlow installed from (source or binary):
  • TensorFlow version (use command below):
  • Bazel version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:
  • Exact command to reproduce:

You can collect some of this information using our environment capture script:

https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh

You can obtain the TensorFlow version with

python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

Describe the problem

Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.

Source code / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.

InomjonRamatov avatar Apr 17 '18 08:04 InomjonRamatov

how to fix the issue??? please help

InomjonRamatov avatar Apr 17 '18 08:04 InomjonRamatov

Traceback (most recent call last): File "object_detection/builders/model_builder_test.py", line 21, in from object_detection.builders import model_builder File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/object_detection-0.1-py3.5.egg/object_detection/builders/model_builder.py", line 17, in from object_detection.builders import anchor_generator_builder File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/object_detection-0.1-py3.5.egg/object_detection/builders/anchor_generator_builder.py", line 21, in from object_detection.protos import anchor_generator_pb2 File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/object_detection-0.1-py3.5.egg/object_detection/protos/anchor_generator_pb2.py", line 15, in from object_detection.protos import grid_anchor_generator_pb2 as object__detection_dot_protos_dot_grid__anchor__generator__pb2 File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/object_detection-0.1-py3.5.egg/object_detection/protos/grid_anchor_generator_pb2.py", line 22, in serialized_pb=_b('\n3object_detection/protos/grid_anchor_generator.proto\x12\x17object_detection.protos"\xcd\x01\n\x13GridAnchorGenerator\x12\x13\n\x06height\x18\x01 \x01(\x05:\x03\x32\x35\x36\x12\x12\n\x05width\x18\x02 \x01(\x05:\x03\x32\x35\x36\x12\x19\n\rheight_stride\x18\x03 \x01(\x05:\x02\x31\x36\x12\x18\n\x0cwidth_stride\x18\x04 \x01(\x05:\x02\x31\x36\x12\x18\n\rheight_offset\x18\x05 \x01(\x05:\x01\x30\x12\x17\n\x0cwidth_offset\x18\x06 \x01(\x05:\x01\x30\x12\x0e\n\x06scales\x18\x07 \x03(\x02\x12\x15\n\raspect_ratios\x18\x08 \x03(\x02') TypeError: new() got an unexpected keyword argument 'serialized_options' (py35) [root@localhost research]# (py35) [root@localhost research]# python object_detection/builders/model_builder_test.py Traceback (most recent call last): File "object_detection/builders/model_builder_test.py", line 21, in from object_detection.builders import model_builder File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/object_detection-0.1-py3.5.egg/object_detection/builders/model_builder.py", line 17, in from object_detection.builders import anchor_generator_builder File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/object_detection-0.1-py3.5.egg/object_detection/builders/anchor_generator_builder.py", line 21, in from object_detection.protos import anchor_generator_pb2 File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/object_detection-0.1-py3.5.egg/object_detection/protos/anchor_generator_pb2.py", line 15, in from object_detection.protos import grid_anchor_generator_pb2 as object__detection_dot_protos_dot_grid__anchor__generator__pb2 File "/root/anaconda3/envs/py35/lib/python3.5/site-packages/object_detection-0.1-py3.5.egg/object_detection/protos/grid_anchor_generator_pb2.py", line 22, in serialized_pb=_b('\n3object_detection/protos/grid_anchor_generator.proto\x12\x17object_detection.protos"\xcd\x01\n\x13GridAnchorGenerator\x12\x13\n\x06height\x18\x01 \x01(\x05:\x03\x32\x35\x36\x12\x12\n\x05width\x18\x02 \x01(\x05:\x03\x32\x35\x36\x12\x19\n\rheight_stride\x18\x03 \x01(\x05:\x02\x31\x36\x12\x18\n\x0cwidth_stride\x18\x04 \x01(\x05:\x02\x31\x36\x12\x18\n\rheight_offset\x18\x05 \x01(\x05:\x01\x30\x12\x17\n\x0cwidth_offset\x18\x06 \x01(\x05:\x01\x30\x12\x0e\n\x06scales\x18\x07 \x03(\x02\x12\x15\n\raspect_ratios\x18\x08 \x03(\x02') TypeError: new() got an unexpected keyword argument 'serialized_options'

InomjonRamatov avatar Apr 17 '18 08:04 InomjonRamatov

I apologize, but I am having a hard time understanding what the problem is, where the problem is, and what version it affects. Please resubmit and pay attention to the issue template (https://github.com/tensorflow/tensorflow/issues/new). Please provide all the information it asks. Thank you.

k-w-w avatar Apr 17 '18 22:04 k-w-w

I too had this issue when I was compiling my protobuf with protoc version 3.5.x. But, when I changed my protoc version to 3.4.0, the problem vanished.

vivekbhadouria avatar Apr 18 '18 04:04 vivekbhadouria

@vivekbhadouria how did you install the 3.4.0, I also have the same problem with object-detection-api, which lower version not working and newer version also not working, I think the middle version will work, so I don't know how to install 3.4.0, now the installed version is 3.5.1, not working, I have installed it from source. Thanks!!

Bahramudin avatar May 10 '18 06:05 Bahramudin

@Bahramudin If I remember correctly then I first removed the protoc installed on my machine, then you install the required version i.e. 3.4.0. Can you try below mentioned commands to install? I remember I noted these lines from SO but I forgot the link

# Grab the version you need
curl -OL https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-linux-x86_64.zip
# Unzip
unzip protoc-3.4.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
sudo mv protoc3/include/* /usr/local/include/

After performing above steps, please run protoc --version to cross-check the installation. HTH

vivekbhadouria avatar May 10 '18 08:05 vivekbhadouria

@vivekbhadouria Thanks! problem has been solved by installing protobuf 3.4.0.

Bahramudin avatar May 10 '18 09:05 Bahramudin

pip install -U protobuf

worked for me. It updated protobuf to v3.6

keevee09 avatar Jun 26 '18 05:06 keevee09

pip install -U protobuf worked for me too. Thanks @keevee09 .

MuhammedBuyukkinaci avatar Jun 26 '18 18:06 MuhammedBuyukkinaci

Thanks a lot @keevee09, it worked!

roffel avatar Jul 05 '18 08:07 roffel

Do I need to rebuild tensorflow and install after upgrading to protobuf 3.6.0?

Sawatdatta avatar Jul 05 '18 11:07 Sawatdatta

make sure to compile the Protobuf libraries again @Sawatdatta

sujaybabruwad avatar Jul 15 '18 15:07 sujaybabruwad

Why protoc 3.4.0 doesn't work for me? (win10) I still get TypeError: __new__() got an unexpected keyword argument 'serialized_options'

JackShaw2333 avatar Aug 06 '18 02:08 JackShaw2333

Same here:

protoc --version
libprotoc 3.4.0

bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
...
...
INFO: Found 1 target...
ERROR: /Users/fernandomartin/projects/tensorflow/tensorflow/BUILD:581:1: Executing genrule //tensorflow:tensorflow_python_api_gen failed (Exit 1)
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_fernandomartin/86a50f68aec4b46d60ac0b40b849c4a9/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/python/tools/api/generator/create_python_api.py", line 27, in <module>
    from tensorflow.python.tools.api.generator import doc_srcs
  File "/private/var/tmp/_bazel_fernandomartin/86a50f68aec4b46d60ac0b40b849c4a9/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "/private/var/tmp/_bazel_fernandomartin/86a50f68aec4b46d60ac0b40b849c4a9/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/core/framework/graph_pb2.py", line 15, in <module>
    from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
  File "/private/var/tmp/_bazel_fernandomartin/86a50f68aec4b46d60ac0b40b849c4a9/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/core/framework/node_def_pb2.py", line 15, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "/private/var/tmp/_bazel_fernandomartin/86a50f68aec4b46d60ac0b40b849c4a9/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/core/framework/attr_value_pb2.py", line 15, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "/private/var/tmp/_bazel_fernandomartin/86a50f68aec4b46d60ac0b40b849c4a9/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/core/framework/tensor_pb2.py", line 15, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File "/private/var/tmp/_bazel_fernandomartin/86a50f68aec4b46d60ac0b40b849c4a9/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/core/framework/resource_handle_pb2.py", line 22, in <module>
    serialized_pb=_b('\n/tensorflow/core/framework/resource_handle.proto\x12\ntensorflow\"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01 \x01(\t\x12\x11\n\tcontainer\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\thash_code\x18\x04 \x01(\x04\x12\x17\n\x0fmaybe_type_name\x18\x05 \x01(\tBn\n\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01Z=github.com/tensorflow/tensorflow/tensorflow/go/core/framework\xf8\x01\x01\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'serialized_options'
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.960s, Critical Path: 0.45s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

macOs 10.13.16 python 2.7.13

SenhorCastor avatar Aug 11 '18 22:08 SenhorCastor

@SenhorCastor Just uninstall and then reinstall the protobuf.

sudo pip uninstall protobuf
sudo pip install -U protobuf

For me this worked!

RahulBhalley avatar Oct 06 '18 11:10 RahulBhalley

@SenhorCastor只需卸载然后重新安装protobuf即可。

sudo pip uninstall protobuf
sudo pip install -U protobuf

对我来说这很有效!

这对我来说还是不行

hanlaoshi avatar Oct 14 '18 03:10 hanlaoshi

@hanlaoshi Please write in English!!!!

Bahramudin avatar Oct 14 '18 17:10 Bahramudin

This is still not work for me.

hanlaoshi avatar Oct 15 '18 09:10 hanlaoshi

This is still not work for me.

@hanlaoshi What error are you getting?

RahulBhalley avatar Oct 15 '18 11:10 RahulBhalley

@hanlaoshi Please write in English!!!!

@Bahramudin use deep learning to translate. @hanlaoshi said, "This is still not good for me". I used Google Translate. 😅

RahulBhalley avatar Oct 15 '18 11:10 RahulBhalley