title: EOFError: Compressed file ended before the end-of-stream marker was reached - MNIST data set
body: <p>I am getting the following error when I run <code>mnist = input_data.read_data_sets("MNIST_data", one_hot = True)</code>.</p>
  
  <blockquote>
    <p>EOFError: Compressed file ended before the end-of-stream marker was reached</p>
  </blockquote>
  
  <p>Even when I extract the file manually and place it in the <code>MNIST_data</code> directory, the program is still trying to download the file instead of using the extracted file. </p>
  
  <p>When I extract the file using WinZip which is the manual way, WinZip tells me that the file is corrupt. </p>
  
  <p><strong>How do I solve this problem?</strong> </p>
  
  <p>I can't even load the data set now, I still have to debug the program itself. Please help.</p>
  
  <p>I pip installed Tensorflow and so I don't have a Tensorflow example. So I went to GitHub to get the <code>input_data</code> file and saved it in the same directory as my <code>main.py</code>. The error is just regarding the .gz file. The program could not extract it.</p>
  
  <blockquote>
    <p>runfile('C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py', wdir='C:/Users/Nikhil/Desktop/Tensor Flow')
    Reloaded modules: input_data
    Extracting MNIST_data/train-images-idx3-ubyte.gz
    C:\Users\Nikhil\Anaconda3\lib\gzip.py:274: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future
      return self._buffer.read(size)
    Traceback (most recent call last):</p>
    
    <p>File "", line 1, in 
        runfile('C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py', wdir='C:/Users/Nikhil/Desktop/Tensor Flow')</p>
    
    <p>File "C:\Users\Nikhil\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
        execfile(filename, namespace)</p>
    
    <p>File "C:\Users\Nikhil\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
        exec(compile(f.read(), filename, 'exec'), namespace)</p>
    
    <p>File "C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py", line 26, in 
        mnist = input_data.read_data_sets("MNIST_data/", one_hot = True)</p>
    
    <p>File "C:\Users\Nikhil\Desktop\Tensor Flow\input_data.py", line 181, in read_data_sets
        train_images = extract_images(local_file)</p>
    
    <p>File "C:\Users\Nikhil\Desktop\Tensor Flow\input_data.py", line 60, in extract_images
        buf = bytestream.read(rows * cols * num_images)</p>
    
    <p>File "C:\Users\Nikhil\Anaconda3\lib\gzip.py", line 274, in read
        return self._buffer.read(size)</p>
    
    <p>File "C:\Users\Nikhil\Anaconda3\lib_compression.py", line 68, in readinto
        data = self.read(len(byte_view))</p>
    
    <p>File "C:\Users\Nikhil\Anaconda3\lib\gzip.py", line 480, in read
        raise EOFError("Compressed file ended before the "</p>
    
    <p>EOFError: Compressed file ended before the end-of-stream marker was reached</p>
  </blockquote>