Repository navigation
0.5.0 wheel install on Mac OS X using Homebrew python broken #11
Description
Activity
Okay, I was able to reproduce this in virtualenv by installing protobuf==2.6.1
The short answer is that we depend on protobuf 3.0.0, and having the protobuf pip library installed seems to interfere with ours.
Two solutions:
- pip install protobuf=3.0.0a1 or higher, then pip install tensorflow
- pip uninstall protobuf first, and then install tensorflow again -- it should bring in the dependency
I was able to do both in virtualenv and they worked -- let me know if either suffices for you. We might add protobuf >= 3 to our whl dependencies if so.
Tensorflow does not bring dependency on protobuf:
gp@MacBook-Pro-Gregory ~> pip list mercurial (3.5.2) pip (7.1.2) setuptools (18.5) vboxapi (1.0) wheel (0.26.0) gp@MacBook-Pro-Gregory ~> pip install --no-cache-dir https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl Collecting tensorflow==0.5.0 from https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl Downloading https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl (9.8MB) 100% |████████████████████████████████| 9.8MB 13.7MB/s Collecting six>=1.10.0 (from tensorflow==0.5.0) Downloading six-1.10.0-py2.py3-none-any.whl Collecting numpy>=1.9.2 (from tensorflow==0.5.0) Downloading numpy-1.10.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.7MB) 100% |████████████████████████████████| 3.7MB 9.5MB/s Installing collected packages: six, numpy, tensorflow Successfully installed numpy-1.10.1 six-1.10.0 tensorflow-0.5.0 gp@MacBook-Pro-Gregory ~> pip list mercurial (3.5.2) numpy (1.10.1) pip (7.1.2) setuptools (18.5) six (1.10.0) tensorflow (0.5.0) vboxapi (1.0) wheel (0.26.0)
Installing protobuf3 before does not help, either:
gp@MacBook-Pro-Gregory ~> pip list mercurial (3.5.2) pip (7.1.2) setuptools (18.5) vboxapi (1.0) wheel (0.26.0) gp@MacBook-Pro-Gregory ~> pip install protobuf==3.0.0a1 Collecting protobuf==3.0.0a1 Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/site-packages (from protobuf==3.0.0a1) Installing collected packages: protobuf Successfully installed protobuf-3.0.0a1 gp@MacBook-Pro-Gregory ~> pip install --no-cache-dir https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl Collecting tensorflow==0.5.0 from https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl Downloading https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl (9.8MB) 100% |████████████████████████████████| 9.8MB 65.8MB/s Collecting six>=1.10.0 (from tensorflow==0.5.0) Downloading six-1.10.0-py2.py3-none-any.whl Collecting numpy>=1.9.2 (from tensorflow==0.5.0) Downloading numpy-1.10.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.7MB) 100% |████████████████████████████████| 3.7MB 3.4MB/s Installing collected packages: six, numpy, tensorflow Successfully installed numpy-1.10.1 six-1.10.0 tensorflow-0.5.0 gp@MacBook-Pro-Gregory ~> python Python 2.7.10 (default, Nov 9 2015, 20:28:23) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 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'
Unless I am missing something, neither of the solutions work for me. Latest OS X, python2 + python3 installed from Homebrew.
This fixed the problem for me:
pip uninstall protobuf pip uninstall tensorflow brew uninstall protobuf pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whlReacted by Nhan Vu, COSXIN, Bryan (Ning) Xia, Snehal Patel, Kentaro Wada, David Mayo, Cheng Zhao, Johnny Yin, Suyash K, tarek and 22 moreReacted by Xu Zheng, Guandao Yang, Matt Le and Jenna Choiflyingmutant: to appease my curiosity, can you let us know what you get when you do the following in python:
import google.protobuf >>> print google.protobuf.__version__ 3.0.0a4
(it's possible google.protobuf.version doesn't exist either in one of the environments I've tested).
Basically the symptom of the problem is that python is finding the older version of the protobuf library that doesn't support the generated python proto3 we require.
Found the same issue on my end.
pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl Collecting tensorflow==0.5.0 from https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl Using cached https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl Collecting six>=1.10.0 (from tensorflow==0.5.0) Using cached six-1.10.0-py2.py3-none-any.whl Collecting numpy>=1.9.2 (from tensorflow==0.5.0) Using cached numpy-1.10.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl Installing collected packages: six, numpy, tensorflow Found existing installation: six 1.4.1 DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project. Uninstalling six-1.4.1: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run root=options.root_path, File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 640, in install requirement.uninstall(auto_confirm=True) File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 716, in uninstall paths_to_remove.remove(auto_confirm) File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove renames(path, new_path) File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/__init__.py", line 315, in renames shutil.move(old, new) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move copy2(src, real_dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2 copystat(src, dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat os.chflags(dst, st.st_flags) OSError: [Errno 1] Operation not permitted: '/var/folders/_f/95xpdnrx4yncxz91dt53mvfh0000gn/T/pip-ZXxpkX-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'This issue (pypa/pip#3165) has more insight into the same. And according to this its the issue with
sixlibrary being preinstalled in El Captain systems.Moreover there seems to be no solution as of now except installing python locally using brew rather than using pre-installed package by Apple.
@vrv I've got
AttributeError: 'module' object has no attribute '__version__'for both 3.0.0a1 and 3.0.0a3 (which is the latest you can install with pip).I've found what fixes the issue for me:
$ brew uninstall protobuf $ pip uninstall protobuf $ pip install 'protobuf>=3.0.0a3' $ pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whlIt appears that Homebrew's protobuf package was causing the issues. Removing it, then installing protobuf3 with pip does the trick.
Reacted by Muneeb SheikhFor the protobuf issue above on OS X, not only should you
pip uninstall protobufto get rid of protobuf 2.x, but make sure youbrew uninstall protobufif you are using homebrew.@VikramTiwari : that is a different issue, already addressed in the "common problems" section of the 'Get Started' page
@dvj Yup! Got it just now. Instructions by @flyingmutant did the trick.
Thanks for the help debugging everyone! We'll try to update our 'common problems' section soon to include these suggestions.
By the way, if you would like to use homebrew, you can install protobuf 3 via:
brew install --devel protobuf
For more details please refer to grpc/grpc-experiments#162
I was able to solve this by doing
brew reinstall --devel protobuf, which installs3.0.0a1. Feel free to close the issue whenever you update the docs.I have the same problem, but my protobuf is apparently up-to-date?
Here is the output to
pip show numpy protobufName: numpy Version: 1.10.1 Location: /mnt/4tb_internal/python/tensorflow/lib/python2.7/site-packages Requires: Name: protobuf Version: 3.0.0a3 Location: /mnt/4tb_internal/python/tensorflow/lib/python2.7/site-packages Requires: setuptoolsHere is the output to
uname -a. My machine runs Ubuntu 14.04 LTS.Linux yi-2014 3.13.0-64-generic #104-Ubuntu SMP Wed Sep 9 12:36:12 UTC 2015 x86_64 x86_64 x86_64 GNU/LinuxHere are the details of the output:
>>> import tensorflow Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/mnt/4tb_internal/python/tensorflow/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module> from tensorflow.python import * File "/mnt/4tb_internal/python/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 13, in <module> from tensorflow.core.framework.graph_pb2 import * File "/mnt/4tb_internal/python/tensorflow/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 "/mnt/4tb_internal/python/tensorflow/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 "/mnt/4tb_internal/python/tensorflow/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 "/mnt/4tb_internal/python/tensorflow/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' >>>My thread got closed due to being similar to this, but I am not on Mac! I would very much appreciate it if we can leave this one open until this gets resolved!
Woops, sorry liuyipei@! Will re-open the original one. It's the same issue, just on a different platform.
30 remaining items
- added 7 commits that reference this issue
on Apr 9, 2025 - added 5 commits that reference this issue
on Jul 28, 2025 - added a commit that references this issue
on Nov 26, 2025
This is what happens: