Fix “IOError: Not a gzipped file” In TensorFlow Docker Example

TensorFlow_logoIf you are learning TensorFlow there’s a lot of nice options that the TensorFlow tutorial site propose, one of them is the one of using Docker Containers, however I found that while trying to follow through the MNIST example notebook I was getting error:

IOError: Not a gzipped file

This is caused because the notebook attempts to download the MNIST data set from the original site, for whatever reason the downloads are not working but if you try it from a regular browser you’ll be able to download the files however.

So to fix this problem what I did is the following:

1.- Delete the existing files inside the docker container

docker exec rm /tmp/mnist-data/*

2.- Download all the files to your local system:

curl -O http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz
curl -O http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz
curl -O http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz
curl -O http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz

 

3.- get your docker container ID

docker ps

output:

CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS              PORTS                              NAMES

79110284079c        b.gcr.io/tensorflow/tensorflow   “/run_jupyter.sh”        44 minutes ago      Up 44 minutes       6006/tcp, 0.0.0.0:8888->8888/tcp   clever_bhaskara

4.- copy the files from your local folder into your docker container in the /tmp/mnist-data folder

docker cp train-images-idx3-ubyte.gz 79110284079c:/tmp/mnist-data
docker cp train-labels-idx1-ubyte.gz 79110284079c:/tmp/mnist-data
docker cp t10k-images-idx3-ubyte.gz 79110284079c:/tmp/mnist-data
docker cp t10k-labels-idx1-ubyte.gz 79110284079c:/tmp/mnist-data

That should do the trick, keep following the notebook lesson.

Happy Learning.

2 thoughts on “Fix “IOError: Not a gzipped file” In TensorFlow Docker Example

Leave a Reply

Your email address will not be published. Required fields are marked *