Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named core.framework.graph_pb2

Tags:

tensorflow

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.

like image 494
Lanting Guo Avatar asked Dec 14 '22 10:12

Lanting Guo


2 Answers

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!

like image 89
Grisson Xie Avatar answered Feb 23 '23 01:02

Grisson Xie


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.

like image 26
ispin2121 Avatar answered Feb 22 '23 23:02

ispin2121