Lesson 3 - mnist_sample doesn't download

Hi,

I’m trying to download the mnist_sample by calling:
path = untar_data(URLs.MNIST_SAMPLE)

However, I get the following error:
FileExistsError: [Errno 17] File exists: ‘/storage/data/mnist_sample’

I then try to call:
path.ls()

but get the following error:
NameError: name ‘path’ is not defined

I will appreciate any help!
thanks!

Hi Aviad, I don’t know the error but if your using colab means following method works fine for your error

  1. Upgrade the fastai by-
    !pip install fastai --upgrade
  2. And import the fastai vision library-
    from fastai.vision.all import *
  3. And the then untar_dara
    path = untar_data(URLs.MNIST_SAMPLE)
    4.Check the directories
    path.ls()

Thank you for your reply. I’m using gradient; although I tried your suggestion, it still doesn’t work.
Tanks,
Aviad

path is not-defined since untar_data() did not complete successfully to return a value to fall into path.

That might indicate that you had previously downloaded the dataset.
To get a view of storage, try all these

!ls
!ls .fastai
!ls /tmp/.fastai

untar_data() is defined here. I’m not familiar with its use in practice, but you might try force_download.

Or otherwise, once you can see where the dataset already downloaded, you might try something like…

from pathlib import Path
path = Path('yourPathToMnist')

Thanks everyone, it worked using this line:
path = untar_data(URLs.MNIST_SAMPLE, c_key=‘archive’, force_download=True)

1 Like