Andy
Andy

Reputation: 309

Cannot get MNIST dataset through Tensorflow on Anaconda

I am trying to obtain MNIST dataset through Tensorflow as following.

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

As title, I installed Tensorflow on Anaconda (Linux) and the package version is tensorflow 1.8.0 (Refer: https://anaconda.org/anaconda/tensorflow)

But here are the error messages:

from tensorflow.examples.tutorials.mnist import input_data
ModuleNotFoundError: No module named 'tensorflow.examples'; 'tensorflow' is not a package

Is it because the tensorflow version is too old to download MNIST ?

I also found the related question: Cannot get MNIST database through Anaconda/jupyter But this is to download MNIST via sklearn.Is it possible to download through tensorflow on Anaconda?

Upvotes: 0

Views: 873

Answers (1)

Anubhav Singh
Anubhav Singh

Reputation: 8699

Two possible reasons for above error:

  1. Your file name is tensorflow.py, as already pointed out by xdurch0
  2. There is another python file in the same directory, named tensorflow.py. If it exists, simple remove it.

Upvotes: 3

Related Questions