Lanting Guo
Lanting Guo

Reputation: 805

ImportError: No module named core.framework.graph_pb2

When I follow the Installation for linux from tensorflow offical site, everything is fine until the last step: Train your first TensorFlow neural net model.

When I execute the command, python tensorflow/models/image/mnist/convolutional.py, An ImportError promps.

Traceback (most recent call last):
  File "tensorflow/models/image/mnist/convolutional.py", line 13, in <module>
    import tensorflow.python.platform
  File "/home/guo/haplox/Github/tensorflow/tensorflow/__init__.py", line 4, in <module>
    from tensorflow.python import *
  File "/home/guo/haplox/Github/tensorflow/tensorflow/python/__init__.py", line 13, in <module>
    from tensorflow.core.framework.graph_pb2 import *
ImportError: No module named core.framework.graph_pb2

My OS is 14.04.1-Ubuntu.

Upvotes: 4

Views: 11126

Answers (5)

oguz
oguz

Reputation: 83

For me, the solution was to run with python3 instead python

Upvotes: 1

Salvador Dali
Salvador Dali

Reputation: 222929

Most probably you have either outdated version of:

Upvotes: 2

Lanting Guo
Lanting Guo

Reputation: 805

I solved it by using virtualenv, but there are many other factors which may cause the same error.

More solutions are at Github issues #81, #61, #51.

Upvotes: 1

Grisson Xie
Grisson Xie

Reputation: 84

I have met the exactly same issue. once your have installed the tensorflow successfully, it's not about the library dependency anymore.

if your executed the convolution.py 100% accurately as manual and get the exception like below

ImportError: No module named core.framework.graph_b2

this means you are executing the python script exactly under the cloned project root directory,let's say the root named "src".

src$python tensorflow/models/image/mnist/convolutional.py

please try to execute the script in the parent directory of the cloned root directory. for example, if your just clone the tensorflow under src dir, goto its parent dir like xxx and do it again.

xxx$python src/tensorflow/models/image/mnist/convolutional.py

bingo, it works like a charm!

Upvotes: 6

ispin2121
ispin2121

Reputation: 51

I had the same issue and the solution was to uninstalled protocol buffer v2.6.

TensorFlow requires protocol buffer v3.0, which should come with your TensorFlow installation/source. Hope this helps.

Upvotes: 2

Related Questions