IOError: Not a gzipped file
technologiclee opened this issue · comments
I stepped throught the example three times. First after it installed, it gave some numerical output and no images. Then I restarted the computer. Second it gave the following errors and no images. The third time, no numerical output and no images. Are there other packages that should be installed in the virtual environment for the graphs to work?
Step 4 works:
train-images-idx3-ubyte.gz
train-labels-idx1-ubyte.gz
t10k-images-idx3-ubyte.gz
t10k-labels-idx1-ubyte.gz
Step 5:
(train_data,
train_labels,
validation_data,
validation_labels,
test_data,
test_labels) = mnist.get_data(download_dir)
('Extracting', '/tmp/train-images-idx3-ubyte.gz')
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
<ipython-input-7-aa08c9ebe098> in <module>()
5 validation_labels,
6 test_data,
----> 7 test_labels) = mnist.get_data(download_dir)
/home/lee/.local/lib/python2.7/site-packages/tdb/examples/mnist.pyc in get_data(data_root)
61
62 # Extract it into numpy arrays.
---> 63 train_data = extract_data(train_data_filename, 60000)
64 train_labels = extract_labels(train_labels_filename, 60000)
65 test_data = extract_data(test_data_filename, 10000)
/home/lee/.local/lib/python2.7/site-packages/tdb/examples/mnist.pyc in extract_data(filename, num_images)
35 print('Extracting', filename)
36 with gzip.open(filename) as bytestream:
---> 37 bytestream.read(16)
38 buf = bytestream.read(IMAGE_SIZE * IMAGE_SIZE * num_images)
39 data = np.frombuffer(buf, dtype=np.uint8).astype(np.float32)
/home/lee/anaconda2/lib/python2.7/gzip.pyc in read(self, size)
266 try:
267 while size > self.extrasize:
--> 268 self._read(readsize)
269 readsize = min(self.max_read_chunk, readsize * 2)
270 except EOFError:
/home/lee/anaconda2/lib/python2.7/gzip.pyc in _read(self, size)
301
302 self._init_read()
--> 303 self._read_gzip_header()
304 self.decompress = zlib.decompressobj(-zlib.MAX_WBITS)
305 self._new_member = False
/home/lee/anaconda2/lib/python2.7/gzip.pyc in _read_gzip_header(self)
195 magic = self.fileobj.read(2)
196 if magic != '\037\213':
--> 197 raise IOError, 'Not a gzipped file'
198 method = ord( self.fileobj.read(1) )
199 if method != 8:
IOError: Not a gzipped file
I was wrong!
The numerical output and images loaded while I was writing the issue. My browser was 'bogged down' and I thought It was going to crash (which is common for me). It was probably doing the processing for the data at that time. So for anyone who does a search and finds my error report, try giving it some time to load!