Reputation: 31
Getting the following error when working through the ipython notebooks on Google's tensorflow udacity course:
AttributeError: 'module' object has no attribute 'compat'
Trying to call:
tf.compat.as_str(f.read(name)).split()
Running on Ubuntu 14.04 and wondering if this a tensorflow early bug issue or just me being stupid. :P
Upvotes: 3
Views: 4828
Reputation: 1231
I just solved the problem by reinstalling Tensorflow by using "pip" command (Ubuntu 14.04, 64-bit) which is suggested in the following link: "https://www.tensorflow.org/versions/r0.7/get_started/os_setup.html"
I guess you haven't used Docker or other virtualenv. So when another program is removed or installed it happens that it affects Tensorflows functionality. i guess you can solve the problem the way I did just a minute ago.
Upvotes: 0
Reputation: 13
For me(on python2.7), I copy the file: compat.py to the build folder. Then, add the commands to the file:
import compat as cp
Next, replace the call as:
#tf.compat.as_str(f.read(name)).split()
cp.as_str(f.read(name)).split()
I think this is the simplest solution.
Upvotes: 0
Reputation: 654
For me (on python 2.7) this seems to work:
return f.read(name).encode('utf-8').split()
See the module source for what may help under other circumstances.
Upvotes: 0
Reputation: 21917
You're most likely using an older version of TensorFlow. I just noticed that some of our install docs still link to 0.5 -- try upgrading to 0.6 or to head.
I'll fix the docs soon, but in the meantime, if you installed via pip, you can just change the 0.5 to 0.6 in the path. If you're building from source, just check out the appropriate release tag (or head).
Upvotes: 3