1

I have never used tensorflow (or python). I installed Python 3.5.2 from https://www.python.org/downloads/. Then I followed instructions to install tensorflow according to this page, for a Windows 64-bit installation:

https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html#download-and-setup

I followed the steps for Pip installation on windows as a CPU-only install. Then I followed Test the TensorFlow installation/ Run TensorFlow from command line which also seemed mostly fine.

But I hit a brick wall when I try the section Run a TensorFlow demo model. Specifically, the command python -m tensorflow.models.image.mnist.convolutional returns a Error while finding spec for 'tensorflow.models.image.mnist.convolutional' (ImportError: No module named 'tensorflow.models').

I don't really understand the installation nor what I'm missing. Can you tell me what I've screwed up?

Kyle Sweet
  • 306
  • 1
  • 3
  • 15
  • When you say "mostly fine", what do you mean? – Wayne Werner Dec 08 '16 at 19:24
  • 2
    Personally, especially on Windows when it comes to science-y packages (though I have no personal experience with it) I'd recommend using [Anaconda](https://www.continuum.io/downloads). I've heard great things about how nice it makes installing such packages. – Wayne Werner Dec 08 '16 at 19:26
  • @Wayne Werner it behaved perfect except where the example shows "Hello, TensorFlow!", my console showed "b'Hello, TensorFlow!" – Kyle Sweet Dec 08 '16 at 19:29
  • Would I have to uninstall Python from my machine then install Anaconda? – Kyle Sweet Dec 08 '16 at 19:30
  • 1
    According to the tensorflow install instructions `Anaconda install: Install TensorFlow in its own environment for those running the Anaconda Python distribution. Does not impact existing Python programs on your machine.` – Wayne Werner Dec 08 '16 at 20:14
  • I installed Anaconda. When I click on Navigator, it doesn't even load – Kyle Sweet Dec 08 '16 at 21:54
  • Reinstalled everything and have Anaconda now. I can pip install tensorflow in an Anaconda environment but can't "Run a TensorFlow demo model". Are you sure this works on Windows? – Kyle Sweet Dec 13 '16 at 17:39

2 Answers2

2

Tensorflow models have been moved to a different github repository. Therefore, they wont be available out of the box anymore when TF is installed. You can find the file right here: https://github.com/tensorflow/models/blob/master/tutorials/image/mnist/convolutional.py

You can download this file and execute it manually. Sorry for out of date documentation.

gunan
  • 917
  • 5
  • 11
0

To run the example the way you've described I think you'd have to add the tensorflow directory (or directory containing all 3rd party packages) to the PYTHONPATH environment variable as in the answer to this question or be in a directory where python can find the tensorflow module. Alternatively, you can run the example using:

python path/to/convolutional.py

from the command line which passes the script to python.exe and executes it. Make sure to either put in the full path or cd to the directory containing the script.

Using Anaconda as mentioned in your second link might be the best bet as setting PYTHONPATH will be taken care of for you for 3rd party packages installed either using conda or pip.

Community
  • 1
  • 1
pbreach
  • 16,049
  • 27
  • 82
  • 120
  • I don't have a PYTHONPATH environment variable. During installation I checked the box that said something like "Add python to the PATH". Should I create one? Where should it point? – Kyle Sweet Dec 08 '16 at 19:32
  • You would have to get tensorflow on python's search path explained [here](http://stackoverflow.com/q/3144089/2593236) or run the command somewhere where python would see the module (ie same directory). As mentioned in the comments using Anaconda will create this variable for you and include the directory containing 3rd party packages like tensorflow. – pbreach Dec 08 '16 at 19:37
  • I have Anaconda set up but I still can't "Run a TensorFlow demo model". Can you provide any insight about this? – Kyle Sweet Dec 13 '16 at 17:40
  • Now that you're using Anaconda just `pip install tensorflow` then `python -m tensorflow.models.image.mnist.convolutional`. If you tried something else and got a different error please edit the question with this included. I'm currently running the demo. – pbreach Dec 13 '16 at 18:14
  • I tried using conda myself by doing `conda config --add channels conda-forge` then `conda install tensorflow` but the package couldn't be found for Windows 64-bit for some reason. – pbreach Dec 13 '16 at 18:17