Skip to content

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

Description

@iamed2

This is what happens:

~: 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
  Downloading https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl (9.8MB)
    100% |████████████████████████████████| 9.8MB 51kB/s
Collecting six>=1.10.0 (from tensorflow==0.5.0)
  Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.9.2 in /usr/local/lib/python2.7/site-packages (from tensorflow==0.5.0)
Installing collected packages: six, tensorflow
  Found existing installation: six 1.9.0
    Uninstalling six-1.9.0:
      Successfully uninstalled six-1.9.0
Successfully installed six-1.10.0 tensorflow-0.5.0
~: python
Python 2.7.10 (default, Jul 13 2015, 12:05:58)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] 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'

Activity

  1. vrv commented on Nov 9, 2015

    @vrv

    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:

    1. pip install protobuf=3.0.0a1 or higher, then pip install tensorflow
    2. 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.

  2. flyingmutant commented on Nov 9, 2015

    @flyingmutant

    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.

  3. alejandro-isaza commented on Nov 9, 2015

    @alejandro-isaza

    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.whl
    
  4. vrv commented on Nov 9, 2015

    @vrv

    flyingmutant: 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.

  5. VikramTiwari commented on Nov 9, 2015

    @VikramTiwari
    Contributor

    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 six library 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.

  6. flyingmutant commented on Nov 9, 2015

    @flyingmutant

    @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.whl

    It appears that Homebrew's protobuf package was causing the issues. Removing it, then installing protobuf3 with pip does the trick.

  7. dvj commented on Nov 9, 2015

    @dvj

    For the protobuf issue above on OS X, not only should you pip uninstall protobuf to get rid of protobuf 2.x, but make sure you brew uninstall protobuf if you are using homebrew.

    @VikramTiwari : that is a different issue, already addressed in the "common problems" section of the 'Get Started' page

  8. VikramTiwari commented on Nov 9, 2015

    @VikramTiwari
    Contributor

    @dvj Yup! Got it just now. Instructions by @flyingmutant did the trick.

  9. vrv commented on Nov 9, 2015

    @vrv

    Thanks for the help debugging everyone! We'll try to update our 'common problems' section soon to include these suggestions.

  10. Yangqing commented on Nov 9, 2015

    @Yangqing
    Contributor

    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

  11. iamed2 commented on Nov 9, 2015

    @iamed2
    Author

    I was able to solve this by doing brew reinstall --devel protobuf, which installs 3.0.0a1. Feel free to close the issue whenever you update the docs.

  12. liuyipei commented on Nov 10, 2015

    @liuyipei
    Contributor

    I have the same problem, but my protobuf is apparently up-to-date?

    Here is the output to pip show numpy protobuf

    Name: 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: setuptools
    

    Here 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/Linux
    

    Here 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'
    >>> 
    
  13. liuyipei commented on Nov 10, 2015

    @liuyipei
    Contributor

    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!

  14. vrv commented on Nov 10, 2015

    @vrv

    Woops, sorry liuyipei@! Will re-open the original one. It's the same issue, just on a different platform.

  15. 30 remaining items

  16. added 7 commits that reference this issue on Apr 9, 2025
  17. added 2 commits that reference this issue on Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions