Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
755 views
in Technique[技术] by (71.8m points)

macos - Python unable to import tensorflow to Mac OS X 10.8

I am trying to install tensorflow on my mac air (specs: OSX 10.8.4, 4GB RAM). While tensorflow installs cleanly, as on the tensorflow.org page, and I am able to do $ source bin/activate to get a tensorflow prompt, I am not able to import the package in python. This is what I get:

    >>> import tensorflow
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 22, in <module>
    from tensorflow.python.client.client_lib import *
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/client_lib.py", line 35, in <module>
    from tensorflow.python.client.session import InteractiveSession
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 11, in <module>
    from tensorflow.python import pywrap_tensorflow as tf_session
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 2): Symbol not found: ___sincos_stret
  Referenced from: /usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so
  Expected in: /usr/lib/libSystem.B.dylib
 in /usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so

I looked at the common problems section on tensorflow, as well as searched for the ImportError above but have had no luck so far. I wonder if this is a protobuf issue as referenced in Error in python after 'import tensorflow': TypeError: __init__() got an unexpected keyword argument 'syntax' . Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The issue appears to be that the binary distribution of TensorFlow is not compatible with Mac OS X 10.8. The relevant part of the error message is this one:

Symbol not found: ___sincos_stret

According to various sources, this is a known issue when using binaries compiled for a newer version of Mac OS X on 10.8 (Mavericks), because the symbol ___sincos_stret is not defined in the standard libraries for that version of the OS.

To address this, you will need to (i) upgrade to Mac OS X 10.9 or later, (ii) follow the instructions to install from source, or (iii) use Docker.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...