Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError for graph_util from tensorflow.python.framework #3203

Closed
mbaytas opened this issue Jul 6, 2016 · 8 comments
Closed

ImportError for graph_util from tensorflow.python.framework #3203

mbaytas opened this issue Jul 6, 2016 · 8 comments
Assignees

Comments

@mbaytas
Copy link

mbaytas commented Jul 6, 2016

Importing graph_util from tensorflow.python.framework fails with an ImportError.

I discovered this while I was trying to go through the TensorFlow for Poets Codelab, an the the re-training failed.

I can reproduce the same error in my Python shell. I am able to verify that TensorFlow is installed correctly by importing tensorflow, tensor_shape from tensorflow.python.framework, and gfile from tensorflow.python.platform (as in the retraining script); but trying to import graph_util results in the same ImportError:

>>> import tensorflow
# Success
>>> from tensorflow.python.framework import tensor_shape
# Success
>>> from tensorflow.python.platform import gfile
# Success
>>> from tensorflow.python.framework import graph_util
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name graph_util

I have also posted this as a question on Stack Overflow, and haven't received any answers so far. I am not sure if this is a bug or a configuration problem etc. Feels like a bug, since I can import tensor_shape from tensorflow.python.framework no problem.

Environment info

Operating System: OS X El Capitan (v10.11.5)
Python: v2.7.11 via Homebrew

TensorFlow 0.9.0 installed from binary pip package for Mac OS X, CPU only, Python 2.7 (TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py2-none-any.whl).

Steps to reproduce

In Python shell:

>>> from tensorflow.python.framework import graph_util
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name graph_util

What have I tried?

  • Looked to see if the file graph_util is there inside tensorflow/python/framework. It is.
  • Looked to see if the current source code I am examining has undergone any changes since v0.9.0 that would fix this issue that appears in the release that I am using. It doesn't appear so to me.
@Nadja-K
Copy link

Nadja-K commented Jul 6, 2016

I'm having the same problem and can't seem to find a solution with the master branch.
While this is no real solution for the problem itself you could try pulling the r0.9 version from git.
This seems to work for me at the very least.

@aselle
Copy link
Contributor

aselle commented Jul 9, 2016

Assigning @danmane since he is on sync rotation next week to see the patch through.

@vrv
Copy link

vrv commented Jul 13, 2016

I suspect the patch went through, though don't know which commit fixed this :(

@vrv vrv closed this as completed Jul 13, 2016
@mbaytas
Copy link
Author

mbaytas commented Jul 19, 2016

The issue persists.

@vrv
Copy link

vrv commented Jul 19, 2016

Ah, graph_util.py was moved from python/client to python/framework after r0.9. You should either check out the code from the r0.9 branch, or use the nightly PIPs linked from github.com/tensorflow/tensorflow to get access to more recent installs that match the latest source code in master.

@mbaytas
Copy link
Author

mbaytas commented Jul 22, 2016

Solved my problem by checking out the r0.9 branch.

@doganai
Copy link

doganai commented Jan 12, 2018

Are newer versions deprecated?

@hudeqiWH
Copy link

I also encountered the same problem as yours, and I used the following two steps to solve the problem:
1.Activate TensorFlow,and stay active during following steps as well as running retrain.py:
source ~/tensorflow/bin/activate # bash, sh, ksh, or zsh
2.Upgrade TensorFlow version by those steps:
(tensorflow)$ easy_install -U pip
(tensorflow)$ pip install --upgrade tensorflow # for Python 2.7
Reference tensorflow official link:https://www.tensorflow.org/install/install_linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants