0

With Python3.5, I try to use the 'tensorflow' module:

import tensorflow as tf

But.. it says No mudule named tensorflow

I just tried to download the module with pip3:

pip3 install --upgrade tensorflow-gpu

(I have all the requirements to run tensorflow with GPU support as described at tensorflow.org)

Tal Rofe
  • 457
  • 12
  • 46
  • What was the output of "pip3 install --upgrade tensorflow-gpu" when you ran it? – William D. Irons Sep 04 '18 at 17:40
  • @WilliamD.Irons "Successfuly installed absl-py-0.4.1 astor-0.7.1 gast-0.2.0 grpcio-1.14.2 markdown-2.6.11 numpy-1.14.5 protobuf-3.6.1 six-1.11.0 tensorboard-1.10.0 tensorflow-gpu-1.10.0 termcolor-1.1.0 werkzeug-0.14.1 wheel-0.31.1" – Tal Rofe Sep 04 '18 at 17:42

1 Answers1

2

I've seen a similar question here ImportError: No module named tensorflow , here's a sum up of what's inside:

  1. Make sure installation is correct via: pip3 show tensorflow
  2. You can optionally re-install it again using: pip install tensorflow==1.2.0 --ignore-installed
  3. Make sure you're running the python code with Python 3.x, verify using: python --version
  4. Make sure you install TF and run the script through the same user, avoid installing TF using sudo pip install... and running the code with python script.py
Kareem
  • 259
  • 1
  • 3
  • 13
  • I did the following: pip install tensorflow==1.5.0 --ignore-installed Well... now it's working. But how can I know it runs on GPU and not on CPU? – Tal Rofe Sep 04 '18 at 17:39
  • I've never done that before, however .. This question is very promising https://stackoverflow.com/questions/38009682/how-to-tell-if-tensorflow-is-using-gpu-acceleration-from-inside-python-shell – Kareem Sep 04 '18 at 18:06
  • @TalRofe Enabling log and check your terminal – Kareem Sep 04 '18 at 18:06
  • As I'm following "Sheraz" answer (from the link u gave), I only get CPU message. Not GPU... – Tal Rofe Sep 04 '18 at 18:11
  • I don't have much experience with using GPU actually .. But a quick guess, wouldn't that mean that it's not using the GPU?? – Kareem Sep 05 '18 at 22:12