import input_data MNIST tensorflow not working

So let's assume that you are in the directory: /somePath/tensorflow/tutorial (and this is your working directory).

All you need to do is to download the input_data.py file and place it like this. Let's assume that the file name you invoke:

import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
...

is main.py and it is also in the same directory.

Once this is done, you can just start running main.py which will start downloading the files and will put them in the MNIST_data folder (once they are there the script will not be downloading them next time).


The old tutorial said, to import the MNIST data, use:

import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)

This will cause the error. The new tutorial uses the following code to do so:

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)

And this works well.