无法加载本机 TensorFlow 运行时。原因:找不到图像。我究竟做错了什么?
Failed to load the native TensorFlow runtime. Reason : Image not found. What am I doing wrong?
运行 在配备四核 I7 和 NVIDIA GeForce GT 650M 的 Macbook Pro 上。
当 运行 来自 virtualenv.What 的 Tensorflow 时,我收到此错误消息是我做错了吗?我正在使用 protobuf 版本 3.2.0
{
(tensorflow) m:src sm$ 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 "/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/Users/smahesh/src/tensorflow/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(/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: @rpath/libcudart.8.0.dylib
Referenced from: /Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so
Reason: image not found
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
}
感谢您提出的所有建议。我尝试使用
安装仅 CPU 版本的 TensorFlow
{
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.1-py2-none-any.whl
}
解决了问题。有趣的是消息说我没有使用 GPU。
{
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
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
>>> print(sess.run(hello))
Hello, TensorFlow!
}
pip install --upgrade
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.1-py2-
none-any.whl
但往往是:
File "/Users/yuanyinjiao/anaconda/lib/python2.7/site-
packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
return zip_path in self.zipinfo or zip_path in self._index()
File "/Users/yuanyinjiao/anaconda/lib/python2.7/site-
packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
return self._zip_manifests.load(self.loader.archive)
File "/Users/yuanyinjiao/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/Users/yuanyinjiao/anaconda/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg'
所以我从 https://pypi.python.org/pypi/setuptools/0.6c11 下载 setuptools-0.6c11-py2.7.egg
终于成功了。
Found existing installation: tensorflow 1.0.1
Uninstalling tensorflow-1.0.1:
Successfully uninstalled tensorflow-1.0.1
Successfully installed tensorflow-1.0.1
yuanyinjiaodeMacBook-Pro:downloads yuanyinjiao$ python
Python 2.7.13 |Anaconda 4.4.0 (x86_64)| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow
>>> import tensorflow
运行 在配备四核 I7 和 NVIDIA GeForce GT 650M 的 Macbook Pro 上。
当 运行 来自 virtualenv.What 的 Tensorflow 时,我收到此错误消息是我做错了吗?我正在使用 protobuf 版本 3.2.0
{
(tensorflow) m:src sm$ 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 "/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/Users/smahesh/src/tensorflow/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(/Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: @rpath/libcudart.8.0.dylib
Referenced from: /Users/smahesh/src/tensorflow/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so
Reason: image not found
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
}
感谢您提出的所有建议。我尝试使用
安装仅 CPU 版本的 TensorFlow{
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.1-py2-none-any.whl
}
解决了问题。有趣的是消息说我没有使用 GPU。
{
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
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
>>> print(sess.run(hello))
Hello, TensorFlow!
}
pip install --upgrade
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.1-py2-
none-any.whl
但往往是:
File "/Users/yuanyinjiao/anaconda/lib/python2.7/site-
packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
return zip_path in self.zipinfo or zip_path in self._index()
File "/Users/yuanyinjiao/anaconda/lib/python2.7/site-
packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
return self._zip_manifests.load(self.loader.archive)
File "/Users/yuanyinjiao/anaconda/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/Users/yuanyinjiao/anaconda/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg'
所以我从 https://pypi.python.org/pypi/setuptools/0.6c11 下载 setuptools-0.6c11-py2.7.egg 终于成功了。
Found existing installation: tensorflow 1.0.1
Uninstalling tensorflow-1.0.1:
Successfully uninstalled tensorflow-1.0.1
Successfully installed tensorflow-1.0.1
yuanyinjiaodeMacBook-Pro:downloads yuanyinjiao$ python
Python 2.7.13 |Anaconda 4.4.0 (x86_64)| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow
>>> import tensorflow