Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error importing tensorflow in anaconda on Mac OSX

I am trying to import tensorflow using python and anaconda on Mac OSX 10.11.6 (El Capitan). I have followed the instructions on tensorflow.org relating to installation with anaconda as follows:

conda create -n tensorflow pip python=3.6
source activate tensorflow
sudo -H pip3 install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.0-py3-none-any.whl

And then starting python, and typing import tensorflow, produces an error:

ImportError: dlopen(/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _SecKeyCopyExternalRepresentation

Followed by more similar errors which resulted in a failure to load the native tensorflow runtime.

Any assistance would be much appreciated!

like image 214
Penny Hancock Avatar asked Aug 09 '18 11:08

Penny Hancock


People also ask

How do I fix ModuleNotFoundError No module named tensorflow?

The Python "ModuleNotFoundError: No module named 'tensorflow'" occurs when we forget to install the tensorflow module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install tensorflow command.


1 Answers

I had the same error message while installing TensorFlow. I was also using OSX 10.11.6. I got past that step by upgrading OSX. I was tipped off that this was necessary because a few lines farther down on the error message that you posted (after the dlopen part), it mentioned that the libraries had been compiled for a later version of OSX (10.12). When I upgraded to OSX 10.13, that error message went away.

If you're getting the same error in your error message, this will probably get you past that part.

like image 137
Stephen Foster Avatar answered Oct 04 '22 21:10

Stephen Foster