Why can I not import tensorflow-gpu on mac?

3067 views python

I am new to posting here, so forgive me if I mess something up. I have been trying for quite some time to install tensorflow with gpu support on Mac OS 10.12.6. I know Tensorflow for mac support was dropped starting in version 1.2. I am installing version 1.1.0. I was able to install this version, however, when I try to import tensorflow, I get the following stack trace:

import tensorflow as tf

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/workhorse/tensorflow-gpu/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
  File "/Users/workhorse/tensorflow-gpu/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
  File "/Users/workhorse/tensorflow-gpu/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/Users/workhorse/tensorflow-gpu/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
  File "/Users/workhorse/tensorflow-gpu/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
  File "/Users/workhorse/tensorflow-gpu/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: dlopen(/Users/workhorse/tensorflow-gpu/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: @rpath/libcublas.8.0.dylib
  Referenced from: /Users/workhorse/tensorflow-gpu/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
  Reason: image not found

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

I checked out the common reasons but none mentioned the one I have. Thank you for your time and help!

answered question

Perhaps this is similar to this issue? github.com/tensorflow/tensorflow/issues/6729

The link does not show anything, its blank :-/

If it still doesnt there was one answer that might be helpful it was the following:

The error message tells you exactly which library it can't load. Make sure you have that library. Make sure you have its dependencies.

1 Answer


According to the GitHub URL there looks like there might be a fix here

According to one of the users, this seems to be a popular answer:

The following user "yaroslavvb" provided this answer not me

I just did some research I didn't really provide any insight to your answer I hope it helps if not let me know.

posted this

Have an answer?


Please login first before posting an answer.