Tensorflow on Mac: Failed to load the native TensorFlow runtime.

Hi,

I am building a small application to classify images based on certain facial features. I have started a tutorial (https://www.tensorflow.org/hub/tutorials/image_retraining) to retrain a new model on my own images.

However, once I get to:

python retrain.py --image_dir ~/flower_photos

This error get produced:

(mlocad) (base) youssouf-traores-macbook-pro:retraining Youssoufj$ python retrain.py --image_dir ~/flower_photos Traceback (most recent call last): File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.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) File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/imp.py", line 342, in load_dynamic return _load(spec) ImportError: dlopen(/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _SecKeyCopyExternalRepresentation Referenced from: /Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/../libtensorflow_framework.1.dylib Expected in: /System/Library/Frameworks/Security.framework/Versions/A/Security in /Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/../libtensorflow_framework.1.dylib During handling of the above exception, another exception occurred: Traceback (most recent call last): File "retrain.py", line 131, in <module> import tensorflow as tf File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/__init__.py", line 28, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.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) File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/imp.py", line 342, in load_dynamic return _load(spec) ImportError: dlopen(/Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _SecKeyCopyExternalRepresentation Referenced from: /Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/../libtensorflow_framework.1.dylib Expected in: /System/Library/Frameworks/Security.framework/Versions/A/Security in /Users/Youssoufj/Projects/tensorf/retrain/september/retraining/mlocad/lib/python3.7/site-packages/tensorflow/python/../libtensorflow_framework.1.dylib Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
Is there anything to solve this?
tensorflowmacos
3 votesJr3.00
1 Answers
JO218.00
2

Which Tensorflow version do you use? I recommend you to upgrade your Tensorflow.

pip install --upgrade --ignore-installed tensorflow-gpu==1.5

Or you can just remove the version of these command and run without it. It worked for me and for many others.

Here are other discussions about this issue:

  1. Failed to load the native TensorFlow runtime
  2. [Install] Failed to load the native TensorFlow runtime
  3. Failed to load the native TensorFlow runtime in Mac OSX
Reply
JW229.00
0

1.13 version is higher than 1.7. I had that issue on my mac and I had to upgrade my Tensorflow. Removing and installing again is a good idea as well.

Jr3.00
0

@John, 1.7 is a higher version no? At this point, I feel like uninstalling everything and download again

JW229.00
0

Have you tried to upgrade to higher versions? like 1.13.
I'm using Tensorflow 1.13 right now on my Mac Mojave and Ubuntu 16.04 and it works perfectly.

Jr3.00
0

I am using Tensorflow 1.7, as per the tutorial. I tried the methods mentioned but I get errors.

Couldn't find what you were looking for?and we will find an expert to answer.
How helpful was this page?