neural-style-tf icon indicating copy to clipboard operation
neural-style-tf copied to clipboard

ImportError: No module named tensorflow

Open narayansundararajan123 opened this issue 7 years ago • 5 comments

hi

am a newbie to this - When I try the run single image basis usage example -

bash stylize_image.sh ./image_input/lion.jpg ./styles/kandinsky.jpg

it returns with the following error

Rendering stylized image. This may take a while... Traceback (most recent call last): File "neural_style.py", line 1, in import tensorflow as tf ImportError: No module named tensorflow

installed tensorflow using http://www.python36.com/how-to-install-tensorflow-gpu-with-cuda-9-2-for-python-on-ubuntu/ - and was able to test with python3 on correct installation with hello tensorflow but python returns with issues.

please help.

thanks narayan

narayansundararajan123 avatar Jun 05 '18 00:06 narayansundararajan123

You might need to activate the virtual environment: $ source ~/tensorflow/bin/activate Or in the stylize_image.sh file, change python to python3

cysmith avatar Jun 05 '18 08:06 cysmith

thanks! changing python to python3 seems to have worked for the previous error. Now am running into

AttributeError: module 'tensorflow' has no attribute 'Graph'.

narayansundararajan123 avatar Jun 05 '18 17:06 narayansundararajan123

Instead of running the program, can you go into Terminal and type: (tensorflow) $ python3 >> import tensorflow as tf >> g = tf.Graph() >> type(g)

cysmith avatar Jun 06 '18 14:06 cysmith

apologize for the silence - got the whole thing working now. thanks!

narayansundararajan123 avatar Jun 13 '18 03:06 narayansundararajan123

I have the same issue.. what was the solution?

androidlime avatar Oct 03 '21 17:10 androidlime