[PYTHON] Resolve TensorFlow TypeError: __init __ () got an unexpected keyword argument'syntax' on Mac

Google's TensorFlow seems to be amazing, so when I tried to use it, I got an error and stumbled, so I will write down the solution for people with similar circumstances.

Installation

$ pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl

error

>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 13, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
  File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
    serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"d\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'

Solution

pip uninstall protobuf
pip uninstall tensorflow
brew uninstall protobuf
pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl

It seems OK if the version of protobuf is 3.0.0a4.

import google.protobuf
>>> print google.protobuf.__version__
3.0.0a4

reference

0.5.0 wheel install on Mac OS X using Homebrew python broken #11

Recommended Posts

Resolve TensorFlow TypeError: __init __ () got an unexpected keyword argument'syntax' on Mac
TypeError: __init__ () got an unexpected keyword argument What to do with'status'
I got an unfamiliar error in Django: TypeError: resolve () got an unexpected keyword argument'strict'
TypeError: concat () got an unexpected keyword argument'join_axes' when using pandas_profling (Google Colab)
Install Tensorflow on Mac
Implement TensorFlow Lite on Mac [2019 Edition]