Issue with untar_data - checks.txt

(Morgan McGuire) #1

EDIT: Maybe its something to do with the file being downloaded to a .fastai folder instead of a fastai2 folder:

./.fastai/archive/imagewoof.tgz

Hey all when trying to use untar_data I am getting the below error. Getting it both on my local machine (mac) and cloud gpu server.

Code:
src = untar_data(URLs.IMAGEWOOF)

Error:
[Errno 2] No such file or directory: '/home/paperspace/anaconda3/envs/fastai/lib/python3.7/site-packages/fastai2/data/checks.txt'

Any idea what might be going wrong? I tried creating an empty checks.txt file but then it complained about it not being in json format

Full stack trace:

-------------------------------------------------

FileNotFoundErrorTraceback (most recent call last)
in
----> 1 src = untar_data(URLs.IMAGEWOOF, dest = ‘.’)
2 items = get_image_files(src)
3 split_idx = GrandparentSplitter(valid_name=‘val’)(items)

~/anaconda3/envs/fastai/lib/python3.7/site-packages/fastai2/data/external.py in untar_data(url, fname, dest, c_key, force_download, extract_func)
197 dest = default_dest if dest is None else Path(dest)/default_dest.name
198 fname = Path(fname or URLs.path(url))
–> 199 if fname.exists() and _get_check(url) and _check_file(fname) != _get_check(url):
200 print(“A new version of this is available, downloading…”)
201 force_download = True

~/anaconda3/envs/fastai/lib/python3.7/site-packages/fastai2/data/external.py in _get_check(url)
171 #Cell
172 def _get_check(url):
–> 173 checks = json.load(open(Path(file).parent/‘checks.txt’, ‘r’))
174 return checks.get(url, None)
175

FileNotFoundError: [Errno 2] No such file or directory: ‘/home/paperspace/anaconda3/envs/fastai/lib/python3.7/site-packages/fastai2/data/checks.txt’

0 Likes

(Jeremy Howard (Admin)) #2

I believe that paperspace has a modified fastai config file.

0 Likes

(Morgan McGuire) #3

I also had the same error on my macbook, clean conda env:

[Errno 2] No such file or directory: ‘/Users/mcgmorgan/anaconda3/envs/fastai_mmg/lib/python3.7/site-packages/fastai2/data/checks.txt’

I worked around it by untarring manually, just wanted to flag in case others experience the same

0 Likes

(Zachary Mueller) #5

@morgan here is how I went about it, I just copied the function over and skipped the checks (unsafe, definitely):

def untar_imdb(url, fname=None, dest=None, c_key='data', force_download=False, extract_func=tar_extract):
   "Download `url` to `fname` if `dest` doesn't exist, and un-tgz to folder `dest`."
   default_dest = URLs.path(url, c_key=c_key).with_suffix('')
   dest = default_dest if dest is None else Path(dest)/default_dest.name
   fname = Path(fname or URLs.path(url))
   if force_download:
       if fname.exists(): os.remove(fname)
       if dest.exists(): shutil.rmtree(dest)
   if not dest.exists():
       fname = download_data(url, fname=fname, c_key=c_key)
       extract_func(fname, dest.parent)
   return dest

My temporary fix works if you upload a modified external.py to dev/local/data and only if you git-clone the repo

1 Like