macOS: ImportError: cannot import name pywrap_tensorflow


I realize I won’t be able to work on anything computationally heavy but I’m trying to run lesson 1’s lesson1. ipynb locally on macOS 10.12.5. I’ve set the path = "data/dogscats/sample/" so that I’ll only work with a small image set. I’m using the python 2.7.13 version of Anaconda.

The following works without issue when run in a local jupyter notebook:

import tensorflow as tf
from tensorflow.python import *
import numpy as np
from tensorflow.python import pywrap_tensorflow
help(pywrap_tensorflow) # successfully displays the help info```

But if I run the following cell from the lesson 1 notebook:
`import utils; reload(utils)`
`from utils import plots`

It eventually fails with:
`/Users/Latency/anaconda/lib/python2.7/site-packages/tensorflow/python/ in <module>()`
`     49 import numpy as np`
`     50 `
`---> 51 from tensorflow.python import pywrap_tensorflow`
`     52 `
`     53 # Protocol buffers`
`ImportError: cannot import name pywrap_tensorflow`

Full stack trace [here](

All the information I can find about this error seems to be based around running your script from the wrong directory which doesn't seem applicable here. Does anyone have any suggestions? Thank you in advance!

[Similar issue on Stack Overflow](


SOLVED: @eljas’s solution worked for me.